예제 #1
0
def rename_row_id(row_id, refresh=True):
    label = kodi.get_keyboard(kodi.i18n('input_new_label'))
    if label:
        play_history = PlayHistory()
        result = play_history.rename_row_id(row_id, label)
        if result and refresh:
            kodi.refresh_container()
예제 #2
0
def export_strm(row_id, export_path=None):
    if export_path is None:
        export_path = kodi.get_setting('export_path_strm')
        if not export_path:
            export_path = kodi.Dialog().browse(3,
                                               kodi.i18n('export_path_strm'),
                                               'files', '', False, False)
            kodi.set_setting('export_path_strm', export_path)
    if export_path:
        default_filename = ''
        play_history = PlayHistory()
        rows = play_history.get(row_id=row_id)
        if rows:
            url, content_type, title, thumb = rows[0]
            default_filename = kodi.string_to_filename(title) + '.strm'
        strm_name = kodi.get_keyboard(kodi.i18n('strm_filename'),
                                      default_filename)
        if strm_name:
            if export_path.startswith('special://'):
                if not export_path.endswith('/'):
                    export_path += '/'
                    kodi.set_setting('export_path_strm', export_path)
                strm_file = kodi.translate_path(export_path + strm_name)
            else:
                strm_file = os.path.join(export_path, strm_name)
            STRMUtils(strm_file).export(row_id)
예제 #3
0
def get_new_item(player=True):
    play_history = PlayHistory()
    playback_item = play_history.get_input()
    if playback_item:
        from addon_lib.playback import play_this
        play_this(unquote(playback_item),
                  title=unquote(playback_item),
                  player=player)
예제 #4
0
def delete_row(row_id, title='', refresh=True):
    confirmed = kodi.Dialog().yesno(
        kodi.i18n('confirm'),
        '%s \'%s\'%s' % (kodi.i18n('delete_url'), unquote(title), '?'))
    if confirmed:
        play_history = PlayHistory()
        result, rowcount = play_history.delete_row_id(row_id)
        if (result, rowcount) == (1, 1) and refresh:
            kodi.refresh_container()
예제 #5
0
def clear_history(ctype=None):
    ltype = ctype
    if ltype is None:
        ltype = 'all'
    confirmed = kodi.Dialog().yesno(kodi.i18n('confirm'),
                                    kodi.i18n('clear_yes_no') % ltype)
    if confirmed:
        play_history = PlayHistory()
        play_history.clear(ctype)
        kodi.refresh_container()
예제 #6
0
def change_thumb_by_row_id(row_id, local=True, refresh=True):
    if local:
        thumbnail = kodi.Dialog().browse(2, kodi.i18n('choose_thumbnail'),
                                         'pictures', '', True, False,
                                         THUMBNAILS_DIR)
    else:
        thumbnail = kodi.get_keyboard(kodi.i18n('input_new_thumb'))
    if thumbnail and (not thumbnail.endswith('/')) and (
            not thumbnail.endswith('\\')):
        play_history = PlayHistory()
        result = play_history.change_thumb(row_id, thumbnail)
        if result and refresh:
            kodi.refresh_container()
예제 #7
0
def main_route(content_type=''):
    if not content_type:
        return
    content = 'files'
    if content_type == 'audio':
        content = 'songs'
    elif content_type == 'image':
        content = 'images'
    elif content_type == 'video':
        content = 'videos'
    kodi.set_content(content)
    play_history = PlayHistory()
    if play_history.use_directory():
        play_history.history_directory(content_type)
    else:
        playback_item = play_history.history_dialog(content_type)
        if playback_item:
            from addon_lib.playback import play_this
            play_this(unquote(playback_item), player=True)