DxCx / plugin.video.9anime

plugin.video.9anime - 9Anime plugin for kodi
GNU General Public License v3.0
143 stars 47 forks source link

Download Feature #176

Closed ypawar159 closed 6 years ago

ypawar159 commented 6 years ago

Hi Everyone, Previously when 9anime G and F servers were available I could stream the videos fine. But now for sometime these are unavailable and the File Sharing servers like RapidVideo doesn't stream well on my existing ISP network. So if there could be an option to download the episode or entire series (few more flexibility options here) it would be great. I can help in the coding and testing as I was able to reuse this code for making CLI based URL extractor. https://bitbucket.org/ypawar/9anime-downloader

DxCx commented 6 years ago

hey @ypawar159 unfortunately i don't have the capacity to develop new features at the moment, if someone (you?) is willing to open a PR adding a support for this feature it will be gladly accepted..

ypawar159 commented 6 years ago

Hi @DxCx , I have studied this plugin and some Kodi addon development tutorials. Now I am understanding it a bit. So will definitely do some progress on this and let you know.

ypawar159 commented 6 years ago

Hi @DxCx, I have coded another sample addon just to know the kodi environment. For download feature I have evaluated few downlaod managers as follows:

  1. Simple Downloader for xbmc plugins : This is a script addon for kodi. Works fine but it's progress bar is always on top and don't have any control features.
  2. pyLoad : Complete python way. It has api and web interface, but it's not easy to use.
  3. Aria2 : CLI based utility with multiplatform support. Has web interfaces like webui-araia2 and AriaNg and also GUI support with uGet and other. Support RPC interface.
  4. JDownloader : GUI written in JAVA. Has api support and more cool features.

So from these I am considering Aria2 and JDownloader are viable options. As these support resume, scheduling, web interface. Will update here once considerable progress made.

DxCx commented 6 years ago

@ypawar159 - i think the solution should be within kodi to make thinks more simple, if this is not possible we can just create another repo for the downloader that uses this repo as submodule to always be able using the latest NineAnime browser

ypawar159 commented 6 years ago

@DxCx, I have got some success in adding the download option in another plugin I am working on. I am still new to development overall , so I didn't get how the router in your code works, so I coded mine with help of some basic tutorials with mode parameter. So following are the main snippets I used to add download functionality: For every episode link displayed added following:

cmd = 'XBMC.RunPlugin({})'.format(build_url({'mode': 'download', 'dlink': episode["link"]}))
list_item.addContextMenuItems([('Download',cmd)])

And in Download Mode parsed the episode URL and sent that URLto aria2c server:

elif mode[0] == 'download':
    aria_path = __addon__.getSetting('downloadpath')
    dlink = args['dlink'][0]
    paused = __addon__.getSetting('paused')
    aria_Server.aria2.addUri(dlink,{'pause': paused, 'dir':os.path.join(aria_path,'test')})

How can I do the same in your code?

  1. Adding context menu in at episode quality selection window
  2. Adding Download option in router and pointing the links.
ypawar159 commented 6 years ago

Closed by mistake. Reopened.

ypawar159 commented 6 years ago

@ypawar159 - i think the solution should be within kodi to make thinks more simple, if this is not possible we can just create another repo for the downloader that uses this repo as submodule to always be able using the latest NineAnime browser

I think the download manager should be loosely coupled with the Kodi. As not all Kodi instances will have enough storage builtin (SBCs like RPI). Also managing the download manger from kodi interface isn't going to be fun I guess. Ideas are welcome though.

ypawar159 commented 6 years ago

@DxCx, Any hints?

ypawar159 commented 6 years ago

@DxCx Got it working the hard way! Have to select the episode and then after fetching sources option to download them. image

image

image

image

image

DxCx commented 6 years ago

Hey @ypawar159 sorry for late response i had hell of a week.. That looks really awsome If you will open a PR i can give you some hints :)

ypawar159 commented 6 years ago

Hi @DxCx , Opened a PR. Please suggest improvements as it's my first time contribution to open source community. I ain't professional programmer, I do it just because I can with little knowledge I have gained so far.

DxCx commented 6 years ago

hey @ypawar159 thanks, just reviewed it 👍

ypawar159 commented 6 years ago

@DxCx, Will rework on new code base probably this weekend.

ypawar159 commented 6 years ago

@DxCx, I think your idea of having different plugin for managing the download part is way better than coding it in every new plugin being developed. I realized it now when trying to create a new plugin for WCO as per the comments from another issue in this repo. ☺

DxCx commented 6 years ago

good luck =) let me know if you have some questions and i can help

ypawar159 commented 6 years ago

@DxCx, How would I crate a standalone script plugin for this download feature, and integrate with any plugin. Kodi wiki has a tutorial for script plugin but nothing to integrate it into any other plugin.

ypawar159 commented 6 years ago

@DxCx , Something is broken. I replaced my initial changed files with the latest version 0.29, and it's download feature doesn't work. In theory it should have worked as it's dependent files havn't changed.

DxCx commented 6 years ago

i guess that this refering to playSource issue which need to be solved by just using the same prefetch function like play_source

ypawar159 commented 6 years ago

yeah, that I figured later.

ypawar159 commented 6 years ago

Hey @DxCx Kindly take a look at my fork https://github.com/ypawar159/plugin.video.9anime/tree/swift I have added full download feature and also used a mini framework to test the plugin without the Kodi. Let me know what you think of it.

ypawar159 commented 6 years ago

@DxCx, Could you please provide feedback on the above branch.

DxCx commented 6 years ago

Can you please open a PR so i can comment properly? :O

ruegnueg commented 6 years ago

actually I dont get why people would Download Such compressed from openload and so on. if you want to download do it from high quality rips via och or torrent.... or use any Tool to download it via browser or Android Apps....

Spenson commented 6 years ago

@ruegnueg 2 reasons unstable connections causing drops in episodes and if on mobile taking it on the go. I think it is a feature I might use as well.

ypawar159 commented 6 years ago

@Spenson Hey, I am happy to know someone found this feature useful in their own way. The way I had designed this originally was to be used with dedicate download server, so not useful on mobile application really. Though if control can be forgiven the 'Simple Downloader for xbmc plugin' may work on all devices. I havn't got time lately to develop on this feature, so any ideas or PR is appreciated.

ruegnueg commented 6 years ago

people are weird. ill never understand how people could watch something on tiny screens on the go. never ever 😉

Jkrise commented 6 years ago

Well since 9 anime likes to change things, having a backup of anime to fall back on isn't such a bad idea! I would like a download option so that when my internet is on the Fritz, 9 anime is down, or I am spending time at the in-laws and need something better to do than be the odd man out, I have choices :D