from resources.lib.modules import blog_viewer as bv wind = bv.Viewer(title, image=img, text=text) wind.doModal() del wind elif mode[0]=='bblogs': from resources.lib.modules import blog_viewer as bv wind = bv.Viewer('My first window') wind.doModal() del wind ########################################################################################### elif mode[0]=='my_lists': lists = myLists.getLists() for ls in lists: delete = addon.build_plugin_url({'mode':'remove_list','name':ls[0]}) context = [('Remove list','RunPlugin(%s)'%delete)] addon.add_item({'mode': 'open_list', 'path':ls[1], 'name':ls[0]}, {'title': ls[0]}, img=icon_path('my_lists.jpg'), fanart=fanart, is_folder=True, contextmenu_items=context) addon.add_item({'mode':'add_list'},{'title':'[B][COLOR green]Add list...[/COLOR][/B]'},img=icon_path('my_lists.jpg'), fanart=fanart, is_folder=True) addon.end_of_directory() elif mode[0]=='add_list': answ = control.yesnoDialog('Do you want to add local list or remote list?','', '' ,yeslabel='Remote',nolabel='Local') #remote if str(answ)=='1': path = control.get_keyboard('Enter list URL:') name = control.get_keyboard('Enter list title:') if path and name: good = client.request(path)
wind = bv.Viewer(title, image=img, text=text) wind.doModal() del wind elif mode[0] == "bblogs": from resources.lib.modules import blog_viewer as bv wind = bv.Viewer("My first window") wind.doModal() del wind ########################################################################################### elif mode[0] == "my_lists": lists = myLists.getLists() for ls in lists: delete = addon.build_plugin_url({"mode": "remove_list", "name": ls[0]}) context = [("Remove list", "RunPlugin(%s)" % delete)] addon.add_item( {"mode": "open_list", "path": ls[1], "name": ls[0]}, {"title": ls[0]}, img=icon_path("my_lists.jpg"), fanart=fanart, is_folder=True, contextmenu_items=context, ) addon.add_item( {"mode": "add_list"}, {"title": "[B][COLOR green]Add list...[/COLOR][/B]"}, img=icon_path("my_lists.jpg"), fanart=fanart, is_folder=True,
except: pass # if not xbmcvfs.exists(final_path): #temp disabled bc of change in .strm format. Reenable in next version try: file_desc = xbmcvfs.File(final_path, 'w') file_desc.write(strm_string) file_desc.close() except Exception, e: _addon.log('Failed to create .strm file: %s\n%s' % (final_path, e)) elif video_type == 'movie': save_path = _addon.get_setting('movie-folder') save_path = xbmc.translatePath(save_path) strm_string = _addon.build_plugin_url({ 'mode': 'DocSubMenu', 'dialog': '1', 'movie_num': movie_num }) if year: title = '%s (%s)' % (title, year) filename = filename_from_title(title, 'movie') title = re.sub(r'[^\w\-_\. ]', '_', title) final_path = os.path.join(save_path, title, filename) final_path = xbmc.makeLegalFilename(final_path) if not xbmcvfs.exists(os.path.dirname(final_path)): try: try: xbmcvfs.mkdirs(os.path.dirname(final_path)) except: os.path.mkdir(os.path.dirname(final_path)) except Exception, e: try:
try: try: xbmcvfs.mkdirs(os.path.dirname(final_path)) except: os.path.mkdir(os.path.dirname(final_path)) except Exception, e: try: IW_addon.log('Failed to create directory %s' % final_path) except: pass try: file_desc = xbmcvfs.File(final_path, 'w') file_desc.write(strm_string) file_desc.close() except Exception, e: IW_addon.log('Failed to create .strm file: %s\n%s' % (final_path, e)) elif video_type == 'movie': save_path = IW_addon.get_setting('movie-folder') save_path = xbmc.translatePath(save_path) strm_string = IW_addon.build_plugin_url( {'mode': 'DocSubMenu','dialog': '1', 'movie_num': movie_num}) if year: title = '%s (%s)' % (title, year) filename = filename_from_title(title, 'movie') title = re.sub(r'[^\w\-_\. ]', '_', title) final_path = os.path.join(save_path, title, filename) final_path = xbmc.makeLegalFilename(final_path) if not xbmcvfs.exists(os.path.dirname(final_path)): try: try: xbmcvfs.mkdirs(os.path.dirname(final_path)) except: os.path.mkdir(os.path.dirname(final_path)) except Exception, e: try: IW_addon.log('Failed to create directory %s' % final_path) except: pass try: file_desc = xbmcvfs.File(final_path, 'w') file_desc.write(strm_string)
items = myLists.getItems(path) for item in items: addon.add_video_item({'mode': 'play', 'url': item[0],'title':item[1], 'img': item[2]}, {'title': item[1]}, img=item[2], fanart=fanart) addon.end_of_directory() ################################################################################################################################## ################################################################################################################################## elif mode[0]=='reddit': from resources.lib.modules import subreddits items = subreddits.get_subreddits() for item in items: delete = addon.build_plugin_url({'mode':'delete_subreddit','reddit':item}) context = [('Remove subreddit','RunPlugin(%s)'%delete)] addon.add_item({'mode': 'open_subreddit', 'reddit': item}, {'title': item}, img=icon_path('reddit.jpg'), fanart=fanart,contextmenu_items=context,is_folder=True) addon.add_item({'mode': 'add_subreddit'}, {'title': '[B][COLOR green]Add a subreddit[/COLOR][/B]'}, img=icon_path('reddit.jpg'), fanart=fanart) addon.end_of_directory() elif mode[0]=='add_subreddit': from resources.lib.modules import subreddits subreddits.add_subreddit() control.refresh() elif mode[0]=='delete_subreddit': reddit = args['reddit'][0] from resources.lib.modules import subreddits subreddits.remove_subreddit(reddit) control.refresh()