Beispiel #1
0
def codeDialog(code):
    HEADING = st(855)
    LINE1 = st(856)
    LINE2 = st(857) % code

    dialogProgress.create(HEADING, LINE1, LINE2)
    return dialogProgress
Beispiel #2
0
 def settingsContextMenu(self, globalC=False):
     if not globalC:
         contextMenu =   (st(402),   'RunPlugin(%s)' % router.editCollectionUrl(self.file))
     else:
         contextMenu =   (st(403),   'RunPlugin(%s)' % router.editCollectionUrl())
         
     return contextMenu
    def __init__(self):
        self.rows = []
        #self.exampleRows = []

        headingRow = Row()

        headingRow.addLabel(st(670), COLOR_COLUMN, columnspan=2, bold=True)
        headingRow.addLabel(st(671),
                            BOLD_COLUMN,
                            columnspan=2,
                            bold=True,
                            padX=23)
        headingRow.addLabel(st(672),
                            ITALIC_COLUMN,
                            columnspan=3,
                            bold=True,
                            padX=23)
        #headingRow.addLabel(   st(653),    LOCATION_COLUMN,columnspan=2, bold=True, padX=LOCATION_COLUMN_PAD,     alignment=pyxbmct.ALIGN_LEFT)
        #headingRow.addLabel(   st(653),    LOCATION_COLUMN,columnspan=2, bold=True, padX=LOCATION_COLUMN_PAD+23,  alignment=pyxbmct.ALIGN_LEFT)
        self.rows.append(headingRow)

        self.exampleRow = Row()
        #self.examplesTB = self.exampleRow.addTextBox(SETTING_COLUMN, columnspan=7, padX=SETTING_COLUMN_PAD, rowspan=5)
        self.exampleList = None
        self.examples = []

        self._assignedValue = False
    def addFullItem(self, currentFTS, defaultFTS, saveCallback, titleExample, sourceExample=None, countlessTitleExample=None, countlessSourceExample=None):
        assignedFTS = FullTextSettings.fromOther(currentFTS)
        _saved = [False]
        
        
        def onSave(assignedTS):           #this function prevents saveCallback to be called more than once by the other TSes
            if not _saved[0]:   
                saveCallback(assignedFTS)
                _saved[0] = True
        
        
        
        count  = '14hr'
        count2 = '562k'        
        maxChars  = 4
        maxChars2 = 4
        #textIfNone  =' '*11 
        textIfNone2 =' '*12
        
        def exampleText():
                                              
            
            
             
            
            return assignedFTS.fullText(titleExample, sourceExample, count, maxChars, countNumber2=count2, maxChars2=maxChars2)
         
        def countlessExampleText():
            return assignedFTS.fullText(countlessTitleExample, countlessSourceExample, count, maxChars, textIfNone2=textIfNone2)
#             countTS = assignedFTS.countTS        
#             assignedFTS.countTS = None        
#             text = assignedFTS.fullText(countlessTitleExample, countlessSourceExample)
#              
#             assignedFTS.countTS = countTS
#             return text

        
        
        example = Example(exampleText(), self)
        countlessExample = Example(countlessExampleText(), self) 
        self.examples.append(example)
        self.examples.append(countlessExample)
        
        def exampleUpdate():                        
            example.update(exampleText())
            countlessExample.update(countlessExampleText())
            
            
        
        
        radioPadX = 0
        #radioPadX = -14
        self.addItemRow(st(680),  currentFTS.countTS,   defaultFTS.countTS,   assignedFTS.countTS,    exampleUpdate, saveCallback=onSave, showOptions=True,  radioPadX=radioPadX, cLocHolder=currentFTS, dLocHolder=defaultFTS, aLocHolder=assignedFTS)
        self.addItemRow(st(681),  currentFTS.count2TS,  defaultFTS.count2TS,  assignedFTS.count2TS,   exampleUpdate, saveCallback=onSave, showOptions=False, radioPadX=radioPadX) 
                     
               
        radioPadX = 0
        #radioPadX = -14
        self.addItemRow(st(682),  currentFTS.sourceTS,  defaultFTS.sourceTS,  assignedFTS.sourceTS,   exampleUpdate, saveCallback=onSave, showOptions=True,  radioPadX=radioPadX)                                    
        self.addItemRow(st(683),  currentFTS.titleTS,   defaultFTS.titleTS,   assignedFTS.titleTS,    exampleUpdate, saveCallback=onSave)    
Beispiel #5
0
    def settingsContextMenu(self, globalC=False):
        if not globalC:
            contextMenu = (st(402), 'RunPlugin(%s)' %
                           router.editCollectionUrl(self.file))
        else:
            contextMenu = (st(403),
                           'RunPlugin(%s)' % router.editCollectionUrl())

        return contextMenu
def noVideosDialog(kodiFolder):
    HEADING = st(810)
    LINE1 = st(811) % len(kodiFolder.folders())
    LINE2 = st(812)
    OPTIONS = [st(813), st(814)]
    if dialog.ok(HEADING, LINE1, LINE2):
        return dialog.select(HEADING, OPTIONS)

    return -1
Beispiel #7
0
def browse():
    items = ItemList()

    items.addCustomFolder(router.searchYoutubeSelectUrl(), youtubeSearchVisual)
    items.addCustomFolder(router.browseYoutubeSubscriptionsUrl(),
                          youtubeSubscriptionsVisual)
    items.addCustomFolder(router.browseYoutubeCategoriesUrl(),
                          youtubeCategoriesVisual)

    kodiFolders = (
        #path                    #title        #thumb
        #(VIDEO_ROOT_PATH,       st(710)        None,)
        (VIDEO_ADDONS_PATH, st(711), None),
        (VIDEO_LIBRARY_PATH, st(712), None),
        (VIDEO_FILES_PATH, st(713), None),
        (VIDEO_PLAYLISTS_PATH, st(714), None),
        (MUSIC_ADDONS_PATH, st(720), None),
        (MUSIC_LIBRARY_PATH, st(721), None),
        #(MUSIC_FILES_PATH,      st(722),       None),
        (MUSIC_PLAYLISTS_PATH, st(723), None),
        (PROGRAM_ADDONS_PATH, st(730), None),
        (PICTURE_ADDONS_PATH, st(731), None),
        #(PICTURE_FILES_PATH,    ??,            None)
    )

    for kodiFolder in kodiFolders:
        path, title, thumb = kodiFolder
        kodiFolder = KodiFolder.fromPath(path, title, thumb)
        items.addKodiFolder(kodiFolder, kodiFoldersVisual, root=True)

#     if 'win' in sys.platform:
#         items.addCustomFolder(router.browseLocalStorageUrl(),           localStorageVisual)

    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 noVideosDialog(kodiFolder):
    HEADING = st(810)
    LINE1   = st(811) %len(kodiFolder.folders())
    LINE2   = st(812) 
    OPTIONS = [
        st(813),
        st(814)
    ]
    if dialog.ok(HEADING, LINE1, LINE2):
        return dialog.select(HEADING, OPTIONS)
    
    return -1
Beispiel #10
0
def estimateDatesWindow(collection):
    window = SettingsWindow(st(590), width=600, height=550, hideTabs=True)
    tab = Tab('')

    values = (None,             True,       False)          
    labels = (USE_MAIN_TEXT,    st(608),    st(609))    
    
    for cSource in collection.cSourcesKodi:
        tab.addEnum(cSource.title(),         values,      cSource._estimateDates,          None,        lambda value, cSource=cSource: cSource.setEstimateDates(value), customLabels=labels)
    
    
    window.addTabs([tab])
    
    window.show()
    window.delete()
Beispiel #11
0
def sort(sourceType=None):
    currentSort = loadCurrentSort(sourceType)

    if sourceType is None:
        from edit_collection import VIDEO_SORT_OPTIONS, VIDEO_SORT_LABELS
    elif sourceType == SourceType.FOLDER:
        from browse_kodi_folder import VIDEO_SORT_OPTIONS, VIDEO_SORT_LABELS
    else:
        from browse_youtube_channel import VIDEO_SORT_OPTIONS, VIDEO_SORT_LABELS

    labels = list(VIDEO_SORT_LABELS)  #copy list

    #     if currentSort.current == VideoSort.SHUFFLE:
    #         arrow = '*'
    #     else:
    #         arrow = '^'  if currentSort.currentReverse else 'v'

    arrow = ' *'
    labels[currentSort.currentIndex] += ts.color('red', arrow)

    index = dialog.select(st(432), labels)
    if index == -1:
        return

    currentSort.setSelected(VIDEO_SORT_OPTIONS[index], index)
    xbmcTool.refreshContainer()
Beispiel #12
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)
Beispiel #13
0
def parseMethodWindow(collection):
    window = SettingsWindow(st(593), width=600, height=550, hideTabs=True)
    tab = Tab('')
        
    
    values = (pm.NORMAL,        pm.FIRST_IN_FOLDER  )     #pm.FOLDERS_AS_VIDEOS          
    labels = (st(595),          st(596),            )     #st(597)    
    
    for cSource in collection.cSourcesKodi:
        tab.addEnum(cSource.title(),         values,      cSource.parseMethod,          None,        lambda value, cSource=cSource: cSource.setParseMethod(value), customLabels=labels)
    
    
    window.addTabs([tab])
    
    window.show()
    window.delete()
Beispiel #14
0
def sourceClickWindow(collection):
    window = SettingsWindow(st(575), width=600, height=550, hideTabs=True)
    tab = Tab('')
    
    kodiValues = (None,)            +   SOURCE_CLICK_KODI_OPTIONS
    kodiLabels = (USE_MAIN_TEXT,)   +   SOURCE_CLICK_KODI_LABELS
    
    ytValues = (None,)              +   SOURCE_CLICK_YT_OPTIONS
    ytLabels = (USE_MAIN_TEXT,)     +   SOURCE_CLICK_YT_LABELS
    
    
    for cSource in collection.cSources:
        if cSource.isKodiFolder():
            values = kodiValues
            labels = kodiLabels
        else:
            values = ytValues
            labels = ytLabels
            
        tab.addEnum(cSource.title(),         values,      cSource._onClick,          None,        lambda value, cSource=cSource: cSource.setOnClick(value), customLabels=labels)
    
    
    window.addTabs([tab])
    
    window.show()
    window.delete()
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)
Beispiel #16
0
def nextPageVisual(pageNum):
    return CustomFolderVisual(
        st(980) % pageNum,  #title
        TextSettings(
            None,  #color
            False,  #bold?
            False  #italic?
        ),
        None,  #icon
        None  #thumb                           
    )
 def __init__(self):
     self.rows = []
     #self.exampleRows = []
                     
     headingRow = Row()
     
     headingRow.addLabel(    st(670),    COLOR_COLUMN,   columnspan=2, bold=True)
     headingRow.addLabel(    st(671),    BOLD_COLUMN,    columnspan=2, bold=True, padX=23)
     headingRow.addLabel(    st(672),    ITALIC_COLUMN,  columnspan=3, bold=True, padX=23)
     #headingRow.addLabel(   st(653),    LOCATION_COLUMN,columnspan=2, bold=True, padX=LOCATION_COLUMN_PAD,     alignment=pyxbmct.ALIGN_LEFT)
     #headingRow.addLabel(   st(653),    LOCATION_COLUMN,columnspan=2, bold=True, padX=LOCATION_COLUMN_PAD+23,  alignment=pyxbmct.ALIGN_LEFT)        
     self.rows.append(headingRow)        
     
     
     self.exampleRow = Row()
     #self.examplesTB = self.exampleRow.addTextBox(SETTING_COLUMN, columnspan=7, padX=SETTING_COLUMN_PAD, rowspan=5)
     self.exampleList = None        
     self.examples = []
     
     self._assignedValue = False
Beispiel #18
0
def useInFeedWindow(collection):
    window = SettingsWindow(st(516), width=500, height=550, hideTabs=True)
    tab = Tab('')
        
     
    
    for cSource in collection.cSources:
        tab.addBoolFullSpan(cSource.title(),         cSource.useInFeed,      True, lambda value, cSource=cSource: cSource.setUseInFeed(value))
    
    
    window.addTabs([tab])
    
    window.show()
    window.delete()
def browse():
    items = ItemList()
    
    items.addCustomFolder(router.searchYoutubeSelectUrl(),          youtubeSearchVisual)
    items.addCustomFolder(router.browseYoutubeSubscriptionsUrl(),   youtubeSubscriptionsVisual)
    items.addCustomFolder(router.browseYoutubeCategoriesUrl(),      youtubeCategoriesVisual)
    
    
    
    kodiFolders = (
        #path                    #title        #thumb
        #(VIDEO_ROOT_PATH,       st(710)        None,)
        (VIDEO_ADDONS_PATH,      st(711),       None),
        (VIDEO_LIBRARY_PATH,     st(712),       None),
        (VIDEO_FILES_PATH,       st(713),       None),
        (VIDEO_PLAYLISTS_PATH,   st(714),       None),
        
        (MUSIC_ADDONS_PATH,      st(720),       None),
        (MUSIC_LIBRARY_PATH,     st(721),       None),
        #(MUSIC_FILES_PATH,      st(722),       None),
        (MUSIC_PLAYLISTS_PATH,   st(723),       None),
        
        (PROGRAM_ADDONS_PATH,    st(730),       None),
        
        (PICTURE_ADDONS_PATH,    st(731),       None),
        #(PICTURE_FILES_PATH,    ??,            None)
    )
    
    for kodiFolder in kodiFolders:
        path, title, thumb = kodiFolder        
        kodiFolder = KodiFolder.fromPath(path, title, thumb)
        items.addKodiFolder(kodiFolder, kodiFoldersVisual, root=True)
        
    
#     if 'win' in sys.platform:
#         items.addCustomFolder(router.browseLocalStorageUrl(),           localStorageVisual)
    

    items.present(viewStyle)
Beispiel #20
0
def limitsWindow(collection):
    window = SettingsWindow(st(541), width=600, height=550, hideTabs=True)
    tab = Tab('')
    
    
    
    values = (None,)             +   SOURCE_LIMIT_VALUES        
    labels = (USE_MAIN_TEXT,)    +   SOURCE_LIMIT_VALUES
    
    
    for cSource in collection.cSources:
        tab.addEnum(cSource.title(),         values,      cSource._limit,          None,        lambda value, cSource=cSource: cSource.setLimit(value), customLabels=labels)
    
    
    window.addTabs([tab])
    
    window.show()
    window.delete()
Beispiel #21
0
def removeSourceWindow(collection):
#     window = SettingsWindow('Remove Source', width=500, height=550, hideTabs=True, showButtons=False)
#     tab = Tab('Remove')
#     
#     def onClick(cSource):
#         if remove_from_collection.removeDirect(cSource, refreshContainer=False):
#             window.close()
#     
#     for cSource in collection.cSources:
#         tab.addButton(cSource.title(), lambda cSource=cSource: onClick(cSource), columnSpan=8, centered=False)
#         
#     window.addTabs([tab])
#     
#     window.show()
#     window.delete()
    
    selectedIndex = dialog.select(st(517), list(cSource.title() for cSource in collection.cSources))
    if selectedIndex == -1:
        return
    
    remove_from_collection.removeDirect(collection.cSources[selectedIndex], refreshContainer=False)
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)
Beispiel #23
0
from src.li.visual.ViewStyle import ViewStyle
from src.li.visual.TextSettings import TextSettings
from src.li.types.FolderVisual import FolderVisual
from src.li.types.CollectionVisual import CollectionVisual
from src.li.types.CustomFileVisual import CustomFileVisual
from src.tools.addonSettings import string as st

viewStyle = ViewStyle.TVSHOWS

createNewFolderVisual = CustomFileVisual(
    st(825),  #title
    TextSettings(
        None,  #color
        True,  #bold?
        False  #italic?
    ),
    None,  #icon
    None  #thumb
)

foldersVisual = FolderVisual(
    TextSettings(
        None,  #color
        False,  #bold?
        False  #italic?
    ))

createNewCollectionVisual = CustomFileVisual(
    st(826),  #title
    TextSettings(
        None,  #color
    def addItemRow(self,
                   label,
                   currentTS,
                   defaultTS,
                   assignedTS,
                   exampleUpdate,
                   showOptions=False,
                   saveCallback=None,
                   radioPadX=0,
                   cLocHolder=None,
                   dLocHolder=None,
                   aLocHolder=None):
        _assignedValue = [False]

        def assignedValue():
            exampleUpdate()
            _assignedValue[0] = True

        def colorCallback(color):
            assignedTS.color = color
            assignedValue()

        def boldCallback(state):
            assignedTS.bold = state
            assignedValue()

        def italicCallback(state):
            assignedTS.italic = state
            assignedValue()

        def onSave(value):
            if _assignedValue[0] and saveCallback:
                saveCallback(assignedTS)
                _assignedValue[
                    0] = None  #so saveCallback doesn't get called again and again from the other controls

        row = Row()

        if showOptions:

            def setButtonsState(state):
                colorButton.setEnabled(state)
                boldButton.setEnabled(state)
                italicButton.setEnabled(state)
                if locationButton:
                    locationButton.setEnabled(state)

            def showCallback(state):
                assignedTS.show = state
                setButtonsState(state)
                assignedValue()

            radioMove = 30 + radioPadX
            padX = SETTING_COLUMN_PAD - radioMove
            textOffsetX = radioMove

            row.addRadioButton(SETTING_COLUMN,
                               assignedTS.show,
                               defaultTS.show,
                               label=label,
                               changeCallback=showCallback,
                               saveCallback=onSave,
                               columnspan=1,
                               padX=padX,
                               textOffsetX=textOffsetX,
                               alignment=pyxbmct.ALIGN_LEFT)
            #row.addRadioButton(LOCATION_COLUMN, assignedTS.show, defaultTS.show, changeCallback=showCallback, saveCallback=onSave, columnspan=LOCATION_COLUMN_SPAN, padX=LOCATION_COLUMN_PAD)

            buttonsEnabled = assignedTS.show

        else:
            row.addLabel(label,
                         SETTING_COLUMN,
                         columnspan=3,
                         padX=SETTING_COLUMN_PAD,
                         alignment=pyxbmct.ALIGN_LEFT)
            buttonsEnabled = True

        colorButton = row.addEnumButton(st(650),
                                        colors.loweredColors,
                                        currentTS.color,
                                        defaultTS.color,
                                        COLOR_COLUMN,
                                        customLabels=colors.coloredColors,
                                        alignment=pyxbmct.ALIGN_LEFT,
                                        columnspan=1,
                                        changeCallback=colorCallback,
                                        saveCallback=onSave,
                                        returnValue=True,
                                        mode=EnumMode.SELECT,
                                        enabled=buttonsEnabled)
        boldButton = row.addRadioButton(BOLD_COLUMN,
                                        currentTS.bold,
                                        defaultTS.bold,
                                        changeCallback=boldCallback,
                                        saveCallback=onSave,
                                        enabled=buttonsEnabled)
        italicButton = row.addRadioButton(ITALIC_COLUMN,
                                          currentTS.italic,
                                          defaultTS.italic,
                                          changeCallback=italicCallback,
                                          saveCallback=onSave,
                                          enabled=buttonsEnabled)

        if cLocHolder:

            def locationCallback(location):
                aLocHolder.countLocation = location
                assignedValue()

            locationButton = row.addEnumButton(st(673),
                                               LOCATION_OPTIONS,
                                               cLocHolder.countLocation,
                                               dLocHolder.countLocation,
                                               LOCATION_COLUMN,
                                               changeCallback=locationCallback,
                                               saveCallback=onSave,
                                               customLabels=LOCATION_LABELS,
                                               returnValue=True,
                                               alignment=pyxbmct.ALIGN_LEFT,
                                               columnspan=LOCATION_COLUMN_SPAN,
                                               padX=LOCATION_COLUMN_PAD,
                                               enabled=buttonsEnabled)

        else:
            locationButton = None

        if showOptions:
            setButtonsState(assignedTS.show)

        self.rows.append(row)
from Row import Row
from EnumButton import EnumMode
import colors
import pyxbmct.addonwindow as pyxbmct
from src.li.visual import FullTextSettings
from src.li.visual.FullTextSettings import Location
from src.li.visual import TextSettings
from src.tools.addonSettings import string as st

# COUNT_OPTIONS           =   (ct.VIEWS,      ct.SUBSCRIBERS,     ct.VIDEOS,      ct.NEW_VIDEOS)
# COUNT_LABELS            =   (st(682),       st(683),            st(684),        st(685))
#ctToLabel   =   {ct.VIEWS:st(685),  ct.SUBSCRIBERS:st(686),   ct.VIDEOS:st(687),     ct.NEW_VIDEOS:st(688)}

LOCATION_OPTIONS = (Location.LEFT_ALIGNED, Location.LEFT, Location.MIDDLE,
                    Location.RIGHT)
LOCATION_LABELS = (st(690), st(691), st(692), st(693))

COLOR_COLUMN = 5
BOLD_COLUMN = 6
ITALIC_COLUMN = 7

LOCATION_COLUMN = 8
LOCATION_COLUMN_PAD = 15
LOCATION_COLUMN_SPAN = 2


class ListItemTable(object):
    def __init__(self):
        self.rows = []
        #self.exampleRows = []
Beispiel #26
0
 def playAllContextMenu(self):
     contextMenu =       (st(401),   'RunPlugin(%s)' % router.playCollectionUrl(self.file))
     return contextMenu
 def removeContextMenu(self):
     contextMenu = (
         st(410), 'RunPlugin(%s)' %
         router.removeFromCollectionUrl(self.collection.file, self.id))
     return contextMenu
    def addItemRow(self, label, currentTS, defaultTS, assignedTS, exampleUpdate, showOptions=False, saveCallback=None, radioPadX=0, cLocHolder=None, dLocHolder=None, aLocHolder=None):
        _assignedValue = [False]
        
        
        def assignedValue():
            exampleUpdate()
            _assignedValue[0] = True
        
        
        def colorCallback(color):
            assignedTS.color = color
            assignedValue()
        
        def boldCallback(state):
            assignedTS.bold = state
            assignedValue()
            
        def italicCallback(state):
            assignedTS.italic = state
            assignedValue()
            
        def onSave(value):
            if _assignedValue[0] and saveCallback:                
                saveCallback(assignedTS)
                _assignedValue[0] = None     #so saveCallback doesn't get called again and again from the other controls
                
        
        
        
        row = Row()
        
        if showOptions:
            def setButtonsState(state):
                colorButton.setEnabled(state)
                boldButton.setEnabled(state)
                italicButton.setEnabled(state)
                if locationButton:
                    locationButton.setEnabled(state)
            
            
            def showCallback(state):
                assignedTS.show = state
                setButtonsState(state)
                assignedValue()                    
                    
            
                
            radioMove = 30 + radioPadX
            padX = SETTING_COLUMN_PAD - radioMove
            textOffsetX = radioMove
            
            row.addRadioButton(SETTING_COLUMN, assignedTS.show, defaultTS.show, label=label, changeCallback=showCallback, saveCallback=onSave, columnspan=1, padX=padX, textOffsetX=textOffsetX, alignment=pyxbmct.ALIGN_LEFT)
            #row.addRadioButton(LOCATION_COLUMN, assignedTS.show, defaultTS.show, changeCallback=showCallback, saveCallback=onSave, columnspan=LOCATION_COLUMN_SPAN, padX=LOCATION_COLUMN_PAD)
            
            buttonsEnabled = assignedTS.show
            
        else:
            row.addLabel(label, SETTING_COLUMN, columnspan=3, padX=SETTING_COLUMN_PAD, alignment=pyxbmct.ALIGN_LEFT)
            buttonsEnabled = True
                
        colorButton = row.addEnumButton(st(650), colors.loweredColors, currentTS.color, defaultTS.color, COLOR_COLUMN, customLabels=colors.coloredColors, alignment=pyxbmct.ALIGN_LEFT, columnspan=1, changeCallback=colorCallback, saveCallback=onSave, returnValue=True, mode=EnumMode.SELECT, enabled=buttonsEnabled)
        boldButton = row.addRadioButton(BOLD_COLUMN, currentTS.bold, defaultTS.bold, changeCallback=boldCallback, saveCallback=onSave, enabled=buttonsEnabled)
        italicButton = row.addRadioButton(ITALIC_COLUMN, currentTS.italic, defaultTS.italic, changeCallback=italicCallback, saveCallback=onSave, enabled=buttonsEnabled)        

   
            
        if cLocHolder:             
            def locationCallback(location):
                aLocHolder.countLocation = location            
                assignedValue()
                 
             
            locationButton = row.addEnumButton(st(673), LOCATION_OPTIONS, cLocHolder.countLocation, dLocHolder.countLocation, LOCATION_COLUMN, changeCallback=locationCallback, saveCallback=onSave, customLabels=LOCATION_LABELS, returnValue=True, alignment=pyxbmct.ALIGN_LEFT, columnspan=LOCATION_COLUMN_SPAN, padX=LOCATION_COLUMN_PAD, enabled=buttonsEnabled)
            
        else:
            locationButton = None
                 


        if showOptions:
            setButtonsState(assignedTS.show)
        
        self.rows.append(row)
from src.li.visual import FullTextSettings
from src.li.visual.FullTextSettings import Location
from src.li.visual import TextSettings
from src.tools.addonSettings import string as st




# COUNT_OPTIONS           =   (ct.VIEWS,      ct.SUBSCRIBERS,     ct.VIDEOS,      ct.NEW_VIDEOS)
# COUNT_LABELS            =   (st(682),       st(683),            st(684),        st(685))
#ctToLabel   =   {ct.VIEWS:st(685),  ct.SUBSCRIBERS:st(686),   ct.VIDEOS:st(687),     ct.NEW_VIDEOS:st(688)}



LOCATION_OPTIONS        =   (Location.LEFT_ALIGNED, Location.LEFT,     Location.MIDDLE,        Location.RIGHT)
LOCATION_LABELS         =   (st(690),               st(691),           st(692),               st(693))







COLOR_COLUMN = 5
BOLD_COLUMN = 6
ITALIC_COLUMN = 7

LOCATION_COLUMN = 8
LOCATION_COLUMN_PAD = 15
LOCATION_COLUMN_SPAN = 2
Beispiel #30
0
def successDialog():
    HEADING = st(870)
    LINE1 = st(871)

    dialog.ok(HEADING, LINE1)
from src.tools.enum import enum
from src.tools.addonSettings import string as st

SourceType = enum(  FOLDER=1,                       CHANNEL=2,                          PLAYLIST=3)
stToText   = {      SourceType.FOLDER:st(420),      SourceType.CHANNEL:st(421),         SourceType.PLAYLIST:st(422)}



 
class VideoSource(object):            
    def __init__(self, title, studioTitle, tvShowTitle, description, thumb, sourceType, sourceId):                        
        self.title = title
        self.studioTitle = studioTitle
        self.tvShowTitle = tvShowTitle        
        self.description = description
        
        self.thumb = thumb
        self.type = sourceType
        
        self.id = sourceId
        
        

        
###################
## Public Methods##
###################
    def isKodiFolder(self):
        if self.type == SourceType.FOLDER:
            return True
        
def alreadyInCollectionDialog(vSource, collection):
    HEADING       =   st(817)
    LINE1         =   st(818)    %(vSource.typeText(), vSource.title, collection.title)
    
    dialog.ok(HEADING, LINE1)
from src.li.visual.ViewStyle import ViewStyle
from src.li.visual.TextSettings import TextSettings
from src.li.types.CustomFolderVisual import CustomFolderVisual
from src.tools.addonSettings import string as st



viewStyle          =       ViewStyle.TVSHOWS


channelsVisual = CustomFolderVisual (
        st(790),         #title
        
        TextSettings(     
        None,               #color
        False,              #bold?
        False               #italic?
        ),                        
                             
        None,               #icon
        None,               #thumb                                             
)



playlistsVisual = CustomFolderVisual (
        st(791),         #title
        
        TextSettings(     
        None,               #color
        False,              #bold?
Beispiel #34
0
 def deleteContextMenu(self):
     contextMenu =       (st(404),   'RunPlugin(%s)' % router.deleteCollectionUrl(self.file))
     return contextMenu
def successDialog(cSource, collection):    
    HEADING       =   st(819)
    LINE1         =   st(820)    %(cSource.typeText(), cSource.title(), collection.title)
    
    dialog.ok(HEADING, LINE1)
    LINE2   = st(812) 
    OPTIONS = [
        st(813),
        st(814)
    ]
    if dialog.ok(HEADING, LINE1, LINE2):
        return dialog.select(HEADING, OPTIONS)
    
    return -1

def customTitleDialog(kodiFolder):    
    HEADING = st(815)
    return dialog.input(HEADING, kodiFolder.title)
    
    


BROWSE_DIALOG_HEADING = st(816)

def alreadyInCollectionDialog(vSource, collection):
    HEADING       =   st(817)
    LINE1         =   st(818)    %(vSource.typeText(), vSource.title, collection.title)
    
    dialog.ok(HEADING, LINE1)


def successDialog(cSource, collection):    
    HEADING       =   st(819)
    LINE1         =   st(820)    %(cSource.typeText(), cSource.title(), collection.title)
    
    dialog.ok(HEADING, LINE1)
from src.li.visual.ViewStyle import ViewStyle
from src.li.visual.TextSettings import TextSettings
from src.li.types.FolderVisual import FolderVisual
from src.li.types.CollectionVisual import CollectionVisual
from src.li.types.CustomFileVisual import CustomFileVisual
from src.tools.addonSettings import string as st

viewStyle           =       ViewStyle.TVSHOWS


createNewFolderVisual = CustomFileVisual (
      st(825),  #title
      TextSettings(
          None,                 #color
          True,                 #bold?
          False                 #italic?
          ),
                                              
          None,                 #icon
          None                  #thumb
) 


foldersVisual = FolderVisual(
      TextSettings(
          None,        #color
          False,       #bold?
          False        #italic?
          )                                                
)
    HEADING = st(810)
    LINE1 = st(811) % len(kodiFolder.folders())
    LINE2 = st(812)
    OPTIONS = [st(813), st(814)]
    if dialog.ok(HEADING, LINE1, LINE2):
        return dialog.select(HEADING, OPTIONS)

    return -1


def customTitleDialog(kodiFolder):
    HEADING = st(815)
    return dialog.input(HEADING, kodiFolder.title)


BROWSE_DIALOG_HEADING = st(816)


def alreadyInCollectionDialog(vSource, collection):
    HEADING = st(817)
    LINE1 = st(818) % (vSource.typeText(), vSource.title, collection.title)

    dialog.ok(HEADING, LINE1)


def successDialog(cSource, collection):
    HEADING = st(819)
    LINE1 = st(820) % (cSource.typeText(), cSource.title(), collection.title)

    dialog.ok(HEADING, LINE1)
from src.li.visual.ViewStyle import ViewStyle
from src.li.types.VideoVisual import VideoVisual
from src.li.types.AddToCollectionVisual import AddToCollectionVisual
from src.li.types.YoutubePlaylistVisual import YoutubePlaylistVisual
from src.li.visual.FullTextSettings import FullTextSettings, Location
from src.li.visual.TextSettings import TextSettings
from src.tools.addonSettings import string as st


viewStyle          =       ViewStyle.EPISODES


addToCollectionVisual = AddToCollectionVisual (
        st(780),   #title

        TextSettings(
        None,           #color
        False,          #bold?
        False           #italic?
        ),
                                               
        None,           #icon
        None,           #thumb
)



videosVisual = VideoVisual (
    FullTextSettings(
        TextSettings(   #title
            'None',       #color
def customTitleDialog(kodiFolder):
    HEADING = st(815)
    return dialog.input(HEADING, kodiFolder.title)
import sort_videolist as svl
from visual.browse_kodi_folder import viewStyle, addToCollectionVisual, foldersVisual, videosVisual
from src.li.ItemList import ItemList
from src.videosource.kodi import KodiFolder
from src.videosource.VideoSource import SourceType
from src.tools import dialog
from src.tools.addonSettings import string as st
from src.videosource.VideoList import VideoSort as vsr, vsToCounts


VIDEO_SORT_OPTIONS  = (vsr.ORIGINAL,        vsr.DATE,    vsr.DURATION,  vsr.SHUFFLE,    vsr.VIDEO_TITLE,         vsr.PLAYCOUNT,  vsr.LASTPLAYED)
VIDEO_SORT_LABELS   = (st(634),             st(620),     st(622),       st(624),        st(627),                 st(632),        st(633)       )


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
    
from src.li.types.KodiFolderVisual import KodiFolderVisual
from src.tools.addonSettings import string as st

viewStyle = ViewStyle.FILES


def customFoldersVisual(title):
    return CustomFolderVisual(
        title,
        TextSettings(
            None,  #color
            False,  #bold?
            False  #italic?
        ),
        None,  #icon
        None,  #thumb
    )


youtubeSearchVisual = customFoldersVisual(st(700))
youtubeSubscriptionsVisual = customFoldersVisual(st(701))
youtubeCategoriesVisual = customFoldersVisual(st(702))

kodiFoldersVisual = KodiFolderVisual(
    TextSettings(
        None,  #color
        False,  #bold?
        False  #italic?
    ), )

#localStorageVisual          = customFoldersVisual(st(740))
def alreadyInCollectionDialog(vSource, collection):
    HEADING = st(817)
    LINE1 = st(818) % (vSource.typeText(), vSource.title, collection.title)

    dialog.ok(HEADING, LINE1)
Beispiel #44
0
from src import router
from src.tools.addonSettings import string as st
from src.videosource.VideoList import VideoList
from src.videosource.kodi.FolderVideo import ParseMethod




loaded = {}


OnCollectionClick = enum(FEED=1, SOURCES=2, SOURCES_ONLY=3, PLAYALL=4)

GLOBAL_COLLECTION_FILE = 'globalCollection.xml'

D_TITLE = st(400)
D_THUMB = 'special://home/addons/plugin.video.collections/icon.png'
D_DEFAULT = False
D_ONCLICK = OnCollectionClick.FEED  #for global. for individual collection it's None


gc = None
class Collection(object):            
    def __init__(self, title, thumb, feedSettings, sourcesSettings, folderSettings, collectionFile, default=False, onClick=None):        
        self.title = title
        self.thumb = thumb
        self.default = default
        self._onClick = onClick      
                
        self.feedSettings = feedSettings
        self.sourcesSettings = sourcesSettings
def successDialog(cSource, collection):
    HEADING = st(819)
    LINE1 = st(820) % (cSource.typeText(), cSource.title(), collection.title)

    dialog.ok(HEADING, LINE1)
def customTitleDialog(kodiFolder):    
    HEADING = st(815)
    return dialog.input(HEADING, kodiFolder.title)
Beispiel #47
0
from src.li.visual.ViewStyle import ViewStyle
from src.li.visual.TextSettings import TextSettings
from src.li.types.CustomFolderVisual import CustomFolderVisual
from src.tools.addonSettings import string as st

viewStyle = ViewStyle.TVSHOWS

channelsVisual = CustomFolderVisual(
    st(790),  #title
    TextSettings(
        None,  #color
        False,  #bold?
        False  #italic?
    ),
    None,  #icon
    None,  #thumb                                             
)

playlistsVisual = CustomFolderVisual(
    st(791),  #title
    TextSettings(
        None,  #color
        False,  #bold?
        False  #italic?
    ),
    None,  #icon
    None,  #thumb                                             
)

bothVisual = CustomFolderVisual(
    st(792),  #title
Beispiel #48
0
from src.li.visual.ViewStyle import ViewStyle
from src.li.visual.TextSettings import TextSettings
from src.li.types.AddToCollectionVisual import AddToCollectionVisual
from src.li.types.KodiFolderVisual import KodiFolderVisual
#from src.li.types.KodiVideoVisual import KodiVideoVisual
from src.li.types.VideoVisual import VideoVisual
from src.li.visual.FullTextSettings import FullTextSettings, Location
from src.tools.addonSettings import string as st

viewStyle = ViewStyle.EPISODES

addToCollectionVisual = AddToCollectionVisual(
    st(750),  #title
    TextSettings(
        None,  #color
        False,  #bold?
        False  #italic?
    ),
    None,  #icon
    None,  #thumb
)

foldersVisual = KodiFolderVisual(
    TextSettings(
        None,  #color
        False,  #bold?
        False  #italic?
    ), )

# videosVisual = KodiVideoVisual(
#       TextSettings(
    def addFullItem(self,
                    currentFTS,
                    defaultFTS,
                    saveCallback,
                    titleExample,
                    sourceExample=None,
                    countlessTitleExample=None,
                    countlessSourceExample=None):
        assignedFTS = FullTextSettings.fromOther(currentFTS)
        _saved = [False]

        def onSave(
            assignedTS
        ):  #this function prevents saveCallback to be called more than once by the other TSes
            if not _saved[0]:
                saveCallback(assignedFTS)
                _saved[0] = True

        count = '14hr'
        count2 = '562k'
        maxChars = 4
        maxChars2 = 4
        #textIfNone  =' '*11
        textIfNone2 = ' ' * 12

        def exampleText():

            return assignedFTS.fullText(titleExample,
                                        sourceExample,
                                        count,
                                        maxChars,
                                        countNumber2=count2,
                                        maxChars2=maxChars2)

        def countlessExampleText():
            return assignedFTS.fullText(countlessTitleExample,
                                        countlessSourceExample,
                                        count,
                                        maxChars,
                                        textIfNone2=textIfNone2)


#             countTS = assignedFTS.countTS
#             assignedFTS.countTS = None
#             text = assignedFTS.fullText(countlessTitleExample, countlessSourceExample)
#
#             assignedFTS.countTS = countTS
#             return text

        example = Example(exampleText(), self)
        countlessExample = Example(countlessExampleText(), self)
        self.examples.append(example)
        self.examples.append(countlessExample)

        def exampleUpdate():
            example.update(exampleText())
            countlessExample.update(countlessExampleText())

        radioPadX = 0
        #radioPadX = -14
        self.addItemRow(st(680),
                        currentFTS.countTS,
                        defaultFTS.countTS,
                        assignedFTS.countTS,
                        exampleUpdate,
                        saveCallback=onSave,
                        showOptions=True,
                        radioPadX=radioPadX,
                        cLocHolder=currentFTS,
                        dLocHolder=defaultFTS,
                        aLocHolder=assignedFTS)
        self.addItemRow(st(681),
                        currentFTS.count2TS,
                        defaultFTS.count2TS,
                        assignedFTS.count2TS,
                        exampleUpdate,
                        saveCallback=onSave,
                        showOptions=False,
                        radioPadX=radioPadX)

        radioPadX = 0
        #radioPadX = -14
        self.addItemRow(st(682),
                        currentFTS.sourceTS,
                        defaultFTS.sourceTS,
                        assignedFTS.sourceTS,
                        exampleUpdate,
                        saveCallback=onSave,
                        showOptions=True,
                        radioPadX=radioPadX)
        self.addItemRow(st(683),
                        currentFTS.titleTS,
                        defaultFTS.titleTS,
                        assignedFTS.titleTS,
                        exampleUpdate,
                        saveCallback=onSave)
Beispiel #50
0
def successDialog():
    HEADING = st(870)
    LINE1   = st(871)
    
    dialog.ok(HEADING, LINE1)
    
viewStyle           =       ViewStyle.FILES

def customFoldersVisual(title):
    return CustomFolderVisual(
        title,
        TextSettings(
            None,        #color
            False,       #bold?
            False        #italic?
        ),     
                                   
        None,       #icon
        None,       #thumb
    )
    
youtubeSearchVisual         = customFoldersVisual(  st(700) )
youtubeSubscriptionsVisual  = customFoldersVisual(  st(701) )
youtubeCategoriesVisual     = customFoldersVisual(  st(702) )




kodiFoldersVisual = KodiFolderVisual(
    TextSettings(
        None,        #color
        False,       #bold?
        False        #italic?
    ),                            
)

from src.li.types.VideoVisual import VideoVisual
from src.li.types.AddToCollectionVisual import AddToCollectionVisual
from src.li.types.YoutubeChannelVisual import YoutubeChannelVisual
from src.li.types.YoutubeChannelPlaylistsVisual import YoutubeChannelPlaylistsVisual
from src.li.visual.FullTextSettings import FullTextSettings, Location
from src.li.visual.TextSettings import TextSettings
from src.tools.addonSettings import string as st



viewStyle          =       ViewStyle.EPISODES



addToCollectionVisual = AddToCollectionVisual (
        st(770),   #title

        TextSettings(
        None,           #color
        False,          #bold?
        False           #italic?
        ),
                                               
        None,           #icon
        None,           #thumb
)