Ejemplo n.º 1
0
def do_move(recordingFolderPath):
    # move folder: a folder was selected, not a recording
    k_Folder = kfolder.kFolder(os.path.split(recordingFolderPath)[0])
    dest = k_Folder.selectFolder(recordingFolderPath)
    xbmc.log("constants.MOVE, dest = " + str(dest), xbmc.LOGINFO)
    if dest == None: return
    # do nothing if the source path is equal to destination path
    if dest == os.path.split(recordingFolderPath)[0]: return
    move_folder_async(recordingFolderPath, dest)
Ejemplo n.º 2
0
def do_move_rec(recordingFolderPath):
    # move recording: a recording was selected

    # igore the *.rec part. Split the other part in rec_folder, rec_name:
    rec_folder_name = os.path.split(recordingFolderPath)[0]
    (rec_folder, rec_name) = os.path.split(rec_folder_name)
    # UI to select dest folder. Start with rec_folder
    k_Folder = kfolder.kFolder(rec_folder)
    dest_s = k_Folder.selectFolder(rec_folder_name)
    xbmc.log("constants.MOVE, dest_s = " + str(dest_s), xbmc.LOGINFO)
    if dest_s == None: return
    # do nothing if the recording is already in the destination folder
    if dest_s == rec_folder: return
    move_folder_async(recordingFolderPath, os.path.join(dest_s, rec_name))
Ejemplo n.º 3
0
    def doSearch(self, searchString):
#        currentFolder = self.args.get('currentFolder', [self.rootFolder])[0]
# Add special (search) folder
#        url = self.build_url({'mode': 'search', 'currentFolder': currentFolder})
#        li = xbmcgui.ListItem(" search", iconImage = 'DefaultFolder.png')
#        xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url,
#                                listitem=li, isFolder=True)
        searchList = []
        self.createSeachList(self.rootFolder, searchList)
        kf = kfolder.kFolder(self.rootFolder)

        searchStringL = searchString.lower()
        for vdrRecordingFolder in searchList:
            if vdrRecordingFolder.title.lower().find(searchStringL) >= 0:
                relRecordingPath = os.path.split(vdrRecordingFolder.path)[0][len(self.rootFolder)+1:].replace('_', ' ')
                vdrRecordingFolder.description = relRecordingPath + '\n' + vdrRecordingFolder.description
# add context menu
                commands = []
                kf.addContextMenuCommand(commands, 30100, constants.DELETE, vdrRecordingFolder.path)
                vdrRecordingFolder.addDirectoryItem(self.addon_handle, commands, 0)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_DATEADDED)
        xbmcplugin.endOfDirectory(self.addon_handle)
Ejemplo n.º 4
0
        'Notification(VDR Recordings, ' +
        xbmcaddon.Addon(constants.ADDON_NAME).getLocalizedString(30109) + ')',
        False)
    # create list of old files
    old_files = {}
    recursive_add_files(constants.LIBRARY_MOVIES, old_files)
    recursive_add_files(constants.LIBRARY_TV_SHOWS, old_files)
    recursive_add_files(constants.LIBRARY_MUSIC_VIDEOS, old_files)
    # make directories (if required)
    xbmcvfs.mkdirs(constants.LIBRARY_MOVIES)
    xbmcvfs.mkdirs(constants.LIBRARY_TV_SHOWS)
    xbmcvfs.mkdirs(constants.LIBRARY_MUSIC_VIDEOS)
    # add current (new) files
    new_files = {}
    xbmc.log("ADDALLTOLIBRARY, before adding all files", xbmc.LOGINFO)
    kfolder.kFolder(getRootFolder()).parseFolder(-10, new_files)
    xbmc.log("ADDALLTOLIBRARY, after adding all files", xbmc.LOGINFO)
    ## compare list of old files with list of new files, clean up library for files which do no longer exist
    for file in old_files.keys() - new_files.keys():
        # files do no longer exist -> delete
        xbmcvfs.delete(file)
        file_base, ext = os.path.splitext(file)
        if ext != ".strm" and ext != ".nfo": xbmcvfs.delete(file_base + ".edl")
# delete all empty directries
    recursive_delete_empty_dirs(constants.LIBRARY_MOVIES)
    recursive_delete_empty_dirs(constants.LIBRARY_TV_SHOWS)
    recursive_delete_empty_dirs(constants.LIBRARY_MUSIC_VIDEOS)
    # clean up library
    xbmc.log("ADDALLTOLIBRARY, before clean up library", xbmc.LOGINFO)
    xbmc.executebuiltin(
        'Notification(VDR Recordings, ' + xbmcaddon.Addon(
Ejemplo n.º 5
0
 def modeFolder(self):
     currentFolder = self.args.get('currentFolder', [self.rootFolder])[0]
     kf = kfolder.kFolder(currentFolder)
     kf.parseFolder(self.addon_handle, {})