Example #1
0
    def get_downloads(self):
        video_lst = []
        if not os.path.isdir(self.downloads_path):
            util.make_path(self.downloads_path)

        downloads = os.listdir(self.downloads_path)
        for download in downloads:
            download_path = os.path.join(self.downloads_path, download)

            if os.path.isdir(download_path):
                continue

            if os.path.splitext(download_path)[1] in VIDEO_EXTENSIONS:
                filename = os.path.basename(os.path.splitext(download_path)[0])
                url = download_path
                subs = None
                if filename in [os.path.splitext(x)[0] for x in downloads if os.path.splitext(x)[1] in SUBTITLES_EXTENSIONS]:
                    subs = filename + ".srt"

                it = PDownload(download_path)
                it.name = filename
                it.url = url
                it.subs = subs

                downloadManager = DownloadManager.getInstance()
                download = downloadManager.findDownloadByIT(it)

                if download is not None:
                    it.finish_time = download.finish_time
                    it.start_time = download.start_time
                    it.state = download.state
                    it.textState = download.textState
                video_lst.append(it)

        return video_lst
Example #2
0
    def get_downloads(self):
        video_lst = []
        if not os.path.isdir(self.downloads_path):
            util.make_path(self.downloads_path)

        downloads = os.listdir(self.downloads_path)
        for download in downloads:
            download_path = os.path.join(self.downloads_path, download)

            if os.path.isdir(download_path):
                continue

            if os.path.splitext(download_path)[1] in VIDEO_EXTENSIONS:
                filename = os.path.basename(os.path.splitext(download_path)[0])
                url = download_path
                subs = None
                if filename in [os.path.splitext(x)[0] for x in downloads if os.path.splitext(x)[1] in SUBTITLES_EXTENSIONS]:
                    subs = filename + ".srt"

                it = PDownload(download_path)
                it.name = filename
                it.url = url
                it.subs = subs

                downloadManager = DownloadManager.getInstance()
                download = downloadManager.findDownloadByIT(it)

                if download is not None:
                    it.finish_time = download.finish_time
                    it.start_time = download.start_time
                    it.state = download.state
                    it.textState = download.textState
                video_lst.append(it)

        return video_lst
Example #3
0
    def __init__(self, info_file):
        log.info("AddonInfo(%s) initializing.." , '/'.join(info_file.split('/')[-3:]))

        pars = parser.XBMCAddonXMLParser(info_file)
        addon_dict = pars.parse()


        self.id = addon_dict['id']
        self.name = addon_dict['name']
        self.version = addon_dict['version']
        self.author = addon_dict['author']
        self.type = addon_dict['type']
        self.broken = addon_dict['broken']
        self.path = os.path.dirname(info_file)
        self.library = addon_dict['library']
        self.script = addon_dict['script']
        self.tmp_path = config.plugins.archivCZSK.tmpPath.value
        self.data_path = os.path.join(config.plugins.archivCZSK.dataPath.getValue(), self.id)
        self.profile = self.data_path

        # create data_path(profile folder)
        util.make_path(self.data_path)

        if settings.LANGUAGE_SETTINGS_ID in addon_dict['description']:
            self.description = addon_dict['description'][settings.LANGUAGE_SETTINGS_ID]
        elif settings.LANGUAGE_SETTINGS_ID == 'sk' and 'cs' in addon_dict['description']:
            self.description = addon_dict['description']['cs']
        else:
            if not 'en' in addon_dict['description']:
                self.description = u''
            else:
                self.description = addon_dict['description']['en']

        self.requires = addon_dict['requires']
        self.image = os.path.join(self.path, 'icon.png')

        #changelog
        changelog_path = None
        if os.path.isfile(os.path.join(self.path, 'changelog.txt')):
            changelog_path = os.path.join(self.path, 'changelog.txt')

        elif os.path.isfile(os.path.join(self.path, 'Changelog.txt')):
            changelog_path = os.path.join(self.path, 'Changelog.txt')

        else:
            changelog_path = None

        if changelog_path is not None:
            with open(changelog_path, 'r') as f:
                text = f.read()
            try:
                self.changelog = text.decode('windows-1250')
            except Exception:
                log.error('%s c[C]angleog.txt cannot be decoded', self)
                self.changelog = u''
                pass
        else:
            log.error('%s c[C]hangelog.txt file is missing', self)
            self.changelog = u''
Example #4
0
    def __init__(self, info_file):
        log.info("initializing info of addon from %s" , info_file)

        pars = parser.XBMCAddonXMLParser(info_file)
        addon_dict = pars.parse()


        self.id = addon_dict['id']
        self.name = addon_dict['name']
        self.version = addon_dict['version']
        self.author = addon_dict['author']
        self.type = addon_dict['type']
        self.broken = addon_dict['broken']
        self.path = os.path.dirname(info_file)
        self.library = addon_dict['library']
        self.script = addon_dict['script']
        self.tmp_path = settings.TMP_PATH
        self.data_path = os.path.join(config.plugins.archivCZSK.dataPath.getValue(), self.id)
        self.profile = self.data_path

        # create data_path(profile folder)
        util.make_path(self.data_path)

        if settings.LANGUAGE_SETTINGS_ID in addon_dict['description']:
            self.description = addon_dict['description'][settings.LANGUAGE_SETTINGS_ID]
        elif settings.LANGUAGE_SETTINGS_ID == 'sk' and 'cs' in addon_dict['description']:
            self.description = addon_dict['description']['cs']
        else:
            if not 'en' in addon_dict['description']:
                self.description = u''
            else:
                self.description = addon_dict['description']['en']

        self.requires = addon_dict['requires']
        self.image = os.path.join(self.path, 'icon.png')

        #changelog
        changelog_path = None
        if os.path.isfile(os.path.join(self.path, 'changelog.txt')):
            changelog_path = os.path.join(self.path, 'changelog.txt')

        elif os.path.isfile(os.path.join(self.path, 'Changelog.txt')):
            changelog_path = os.path.join(self.path, 'Changelog.txt')

        else:
            changelog_path = None

        if changelog_path is not None:
            with open(changelog_path, 'r') as f:
                text = f.read()
            try:
                self.changelog = text.decode('windows-1250')
            except Exception:
                log.debug('cannot decode c[C]angleog.txt')
                self.changelog = u''
                pass
        else:
            log.debug('c[C]hangelog.txt missing')
            self.changelog = u''
Example #5
0
    def __init__(self, info_file):
        log.info("AddonInfo(%s) initializing.." , '/'.join(info_file.split('/')[-3:]))

        pars = parser.XBMCAddonXMLParser(info_file)
        addon_dict = pars.parse()
        
        self.id = addon_dict['id']
        self.name = addon_dict['name']
        self.version = addon_dict['version']
        self.author = addon_dict['author']
        self.type = addon_dict['type']
        self.broken = addon_dict['broken']
        self.path = os.path.dirname(info_file)
        self.library = addon_dict['library']
        self.script = addon_dict['script']
        self.tmp_path = config.plugins.archivCZSK.tmpPath.value
        self.data_path = os.path.join(config.plugins.archivCZSK.dataPath.getValue(), self.id)
        self.profile = self.data_path

        # create data_path(profile folder)
        util.make_path(self.data_path)

        if settings.LANGUAGE_SETTINGS_ID in addon_dict['description']:
            self.description = addon_dict['description'][settings.LANGUAGE_SETTINGS_ID]
        elif settings.LANGUAGE_SETTINGS_ID == 'sk' and 'cs' in addon_dict['description']:
            self.description = addon_dict['description']['cs']
        else:
            if not 'en' in addon_dict['description']:
                self.description = u''
            else:
                self.description = addon_dict['description']['en']

        self.requires = addon_dict['requires']
        self.image = os.path.join(self.path, 'icon.png')

        #changelog
        changelog_path = None
        if os.path.isfile(os.path.join(self.path, 'changelog.txt')):
            changelog_path = os.path.join(self.path, 'changelog.txt')

        elif os.path.isfile(os.path.join(self.path, 'Changelog.txt')):
            changelog_path = os.path.join(self.path, 'Changelog.txt')

        else:
            changelog_path = None

        if changelog_path is not None:
            with open(changelog_path, 'r') as f:
                text = f.read()
            try:
                self.changelog = text
            except Exception:
                log.error('%s c[C]angleog.txt cannot be decoded', self)
                self.changelog = u''
                pass
        else:
            log.error('%s c[C]hangelog.txt file is missing', self)
            self.changelog = u''