File: runner.py

package info (click to toggle)
kodi-inputstream-ffmpegdirect 1.19.2%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 684 kB
  • sloc: cpp: 6,415; xml: 140; sh: 45; python: 15; makefile: 11
file content (28 lines) | stat: -rw-r--r-- 904 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import xbmc
import xbmcaddon
import xbmcvfs

def hidden(path):
    return path.startswith('.') or path.startswith('_UNPACK')

ADDON = xbmcaddon.Addon()
timeshiftBufferPath = ADDON.getSetting('timeshiftBufferPath')

# Add a trailing slash if we don't have as it's required to test if a directory exists
if not timeshiftBufferPath.endswith("/"):
    timeshiftBufferPath += "/"

if xbmcvfs.exists(timeshiftBufferPath):
    dirs, files = xbmcvfs.listdir(timeshiftBufferPath)
    # xbmcvfs bug: sometimes return invalid utf-8 encoding. we only care about
    # finding changed paths so it's ok to ignore here.

    #dirs = [timeshiftBufferPath + _ for _ in dirs if not hidden(_)]
    files = [timeshiftBufferPath + _ for _ in files if not hidden(_)]

    # for d in dirs:
    #     xbmcvfs.rmdir(d, true)
    for f in files:
        if f.endswith(".idx") or f.endswith(".seg"):
            xbmcvfs.delete(f)