예제 #1
0
def browse(playlistFile, pageNum):
    playlist = Playlist.fromCacheFile(playlistFile)

    items = ItemList(hasQeuingVideos=True)

    if pageNum == 1:
        items.addAddToCollection(playlist, addToCollectionVisual)

    items.addVideoSortYoutube(st(781))

    videos = playlist.videos
    videoList = videos.updatedPageItems(pageNum)

    currentSort = svl.loadCurrentSort(SourceType.PLAYLIST)
    selected = currentSort.selected

    if selected:
        videoList.sort(selected, reverseOrder=currentSort.selectedReverse
                       )  #might cause problems in future cause
        currentSort.setSelectedAsCurrent()  #didn't make a copy
        customVcts = vsToCounts[selected]
        videosVisual.setCustomVcts(customVcts)
    else:
        currentSort.setCurrent(vsr.DATE, 0, False)

    for video in videos.updatedPageItems(pageNum):
        items.addVideo(video, videosVisual)

    if videos.hasPage(pageNum + 1):
        items.addYoutubePlaylist(playlist, nextPageVisual, pageNum + 1)

    items.present(viewStyle)
예제 #2
0
def browse(kodiFolderFile, rootFolder=False, estimateDates=False):
    kodiFolder = KodiFolder.fromCacheFile(kodiFolderFile)
    folders, videos, allItems = kodiFolder.updatedContents(estimateDates)
    
    if kodiFolder.updateFailed():
        dialog.ok(  st(760), st(761), st(762)   )       #parse error dialog
        return
    
    
    
    
    items = ItemList(hasQeuingVideos=True)
        
    if kodiFolder.isEmpty():
        items.present(viewStyle)
        return
    
    
    

    
    
        
    
    if rootFolder:
        for folder in folders:
            if not folder.path.startswith('plugin://plugin.video.collections'):                
                items.addKodiFolder(folder, foldersVisual)
    
    else:
        items.addAddToCollection(kodiFolder, addToCollectionVisual)
        
        if videos:                        
            items.addVideoSortKodi(st(751))                
            currentSort = svl.loadCurrentSort(SourceType.FOLDER)
            selected = currentSort.selected
            
            if selected:
                videos.sort(selected, reverseOrder=currentSort.selectedReverse)   #might cause problems in future cause
                currentSort.setSelectedAsCurrent()                                               #didn't make a copy
                customVcts = vsToCounts[selected]
                videosVisual.setCustomVcts(customVcts)                
            else:           
                currentSort.setCurrent(vsr.ORIGINAL, 0, False)
            

        for folder in folders:
            items.addKodiFolder(folder, foldersVisual)
        
        for kodiVideo in videos:
            #items.addKodiVideo(kodiVideo, videosVisual)
            items.addVideo(kodiVideo, videosVisual)
        
    items.present(viewStyle)
def browse(kodiFolderFile, rootFolder=False, estimateDates=False):
    kodiFolder = KodiFolder.fromCacheFile(kodiFolderFile)
    folders, videos, allItems = kodiFolder.updatedContents(estimateDates)

    if kodiFolder.updateFailed():
        dialog.ok(st(760), st(761), st(762))  #parse error dialog
        return

    items = ItemList(hasQeuingVideos=True)

    if kodiFolder.isEmpty():
        items.present(viewStyle)
        return

    if rootFolder:
        for folder in folders:
            if not folder.path.startswith('plugin://plugin.video.collections'):
                items.addKodiFolder(folder, foldersVisual)

    else:
        items.addAddToCollection(kodiFolder, addToCollectionVisual)

        if videos:
            items.addVideoSortKodi(st(751))
            currentSort = svl.loadCurrentSort(SourceType.FOLDER)
            selected = currentSort.selected

            if selected:
                videos.sort(selected, reverseOrder=currentSort.selectedReverse
                            )  #might cause problems in future cause
                currentSort.setSelectedAsCurrent()  #didn't make a copy
                customVcts = vsToCounts[selected]
                videosVisual.setCustomVcts(customVcts)
            else:
                currentSort.setCurrent(vsr.ORIGINAL, 0, False)

        for folder in folders:
            items.addKodiFolder(folder, foldersVisual)

        for kodiVideo in videos:
            #items.addKodiVideo(kodiVideo, videosVisual)
            items.addVideo(kodiVideo, videosVisual)

    items.present(viewStyle)
def browse(channelFile, pageNum):
    channel = Channel.fromCacheFile(channelFile)
    
    if channel.needsInfoUpdate(checkUploadPlaylist=True):
        channel.fetchInfo()
    
    
    items = ItemList(hasQeuingVideos=True)    
    
    if pageNum == 1:
        items.addAddToCollection(channel, addToCollectionVisual)
        items.addYoutubeChannelPlaylists(channel, playlistsVisual)
        
    items.addVideoSortYoutube(st(772))
    
    videos = channel.videos
    videoList = videos.updatedPageItems(pageNum)
    
    currentSort = svl.loadCurrentSort(SourceType.CHANNEL)
    selected = currentSort.selected
    
    if selected:
        videoList.sort(selected, reverseOrder=currentSort.selectedReverse)   #might cause problems in future cause
        currentSort.setSelectedAsCurrent()                                               #didn't make a copy
        customVcts = vsToCounts[selected]
        videosVisual.setCustomVcts(customVcts)                
    else:           
        currentSort.setCurrent(vsr.DATE, 0, False)
        
    
    
    for video in videoList:
        items.addVideo(video, videosVisual)
        
    
    if videos.hasPage(pageNum+1):
        items.addYoutubeChannel(channel, nextPageVisual, pageNum+1)
        
    items.present(viewStyle)