예제 #1
0
    def deleteBouquets(self, answer=None):
        if answer is None:
            self.session.openWithCallback(
                self.deleteBouquets, MessageBox,
                _('Permanently delete all Jedi created bouquets?'))
        elif answer:
            with open('/etc/enigma2/bouquets.tv', 'r+') as f:
                lines = f.readlines()
                f.seek(0)
                for line in lines:
                    if 'jmx' not in line:
                        f.write(line)
                f.truncate()

            jfunc.purge('/etc/enigma2', 'jmx')

            if jglob.has_epg_importer:
                jfunc.purge('/etc/epgimport', 'jmx')

            self.playlists_all = jfunc.getPlaylistJson()

            jglob.bouquets_exist = False
            jfunc.resetUnique()
            jglob.firstrun = 0
            jglob.current_selection = 0
            jglob.current_playlist = []

            # delete leftover empty dicts
            self.playlists_all = filter(None, self.playlists_all)

            os.remove(playlist_file)
            jfunc.refreshBouquets()

            self.createSetup()
        return
예제 #2
0
	def editEntry(self):
		if self.playlisttypeCfg.value == 'standard':
			
			oldEntry = str(self.protocol) + str(self.domain) + ':' + str(self.port) + '/get.php?username='******'&password='******'&type=' + str(self.type) + \
			'&output=' + str(self.output)
			
			editEntry = '\n' +  str(self.protocolCfg.value) + str(self.serverCfg.value) + ':' + str(self.portCfg.value) + '/get.php?username='******'&password='******'&type=' + str(self.type) + '&output=' + str(self.outputCfg.value) + '\r\n'
			 
		else:
			oldEntry = self.address
			editEntry = '\n' + str(self.addressCfg.value) + '\n'
			
		with open(playlist_path, 'r+') as f:
			new_f = f.readlines()
			f.seek(0)
			for line in new_f:
				if line.startswith(oldEntry):
					line = editEntry
				f.write(line)
				
			f.truncate()
		
		if 'bouquet_info' in jglob.current_playlist:
			jglob.current_playlist['bouquet_info']['name'] = str(self.aliasCfg)
			jglob.current_playlist['bouquet_info']['xmltv_address'] = str(self.xmltvCfg)
						
		if jglob.current_playlist['playlist_info']['playlisttype'] == 'xtream':
			jglob.current_playlist['playlist_info']['protocol'] = str(self.protocolCfg.value)
			jglob.current_playlist['playlist_info']['domain'] = str(self.serverCfg.value)
			jglob.current_playlist['playlist_info']['port'] = str(self.portCfg.value)
			jglob.current_playlist['playlist_info']['username'] = str(self.usernameCfg.value)
			jglob.current_playlist['playlist_info']['password'] = str(self.passwordCfg.value)
			jglob.current_playlist['playlist_info']['output'] = str(self.outputCfg.value)
			jglob.current_playlist['playlist_info']['address'] = str(self.protocolCfg.value) + str(self.serverCfg.value) + ':' + str(self.portCfg.value) + \
			'/get.php?username='******'&password='******'&type=' + str(self.type) + '&output=' + str(self.outputCfg.value)
		else:
			jglob.current_playlist['playlist_info']['address'] = str(self.addressCfg.value)
			
		self.playlists_all = jfunc.getPlaylistJson()
		if self.playlists_all != []:
			   
				for playlist in self.playlists_all:
				   
					if playlist != {}:

						if jglob.current_playlist['playlist_info']['index'] == playlist['playlist_info']['index']:
							 playlist['playlist_info'] = jglob.current_playlist['playlist_info']
							 break
							 
		with open(playlist_file, 'w') as f:
			json.dump(self.playlists_all, f)
예제 #3
0
    def deletePlaylist(self, answer=None):

        if jglob.current_playlist['playlist_info']['playlisttype'] != 'local':
            if answer is None:
                self.session.openWithCallback(
                    self.deletePlaylist, MessageBox,
                    _('Permanently delete selected playlist?'))
            elif answer:
                with open(playlist_path, 'r+') as f:
                    lines = f.readlines()
                    f.seek(0)

                    for line in lines:
                        if line.startswith(
                                jglob.current_playlist['playlist_info']
                            ['address']):
                            continue
                        f.write(line)
                    f.truncate()
                    f.close()

                self.playlists_all = jfunc.getPlaylistJson()
                tempplaylist = self.playlists_all

                if self.playlists_all != []:
                    x = 0
                    for playlist in self.playlists_all:
                        if jglob.current_playlist['playlist_info'][
                                'address'] == playlist['playlist_info'][
                                    'address']:
                            del tempplaylist[x]
                            break
                        x += 1

                    self.playlists_all = tempplaylist

                    with open(playlist_file, 'w') as f:
                        json.dump(self.playlists_all, f)

                self['playlists'].setIndex(0)
                jglob.current_selection = 0
                self.refresh()

        else:
            self.session.open(
                MessageBox,
                _('Delete unavailable for local M3Us.\nManually Delete/Amend M3U files in folder.\n'
                  ) + cfg.m3ulocation.value,
                MessageBox.TYPE_ERROR,
                timeout=5)
        return
예제 #4
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.session = session
        skin = skin_path + 'jmx_bouquets.xml'
        with open(skin, 'r') as f:
            self.skin = f.read()
        self.setup_title = _('Delete Bouquets')

        #new list code
        self.startList = []
        self.drawList = []
        self['list'] = List(self.drawList)

        self['key_red'] = StaticText(_('Cancel'))
        self['key_green'] = StaticText(_('Delete'))
        self['key_yellow'] = StaticText(_('Invert'))
        self['key_blue'] = StaticText(_('Clear All'))
        self['key_info'] = StaticText('')
        self['description'] = Label(
            _('Select all the iptv bouquets you wish to delete. \nPress OK to invert the selection'
              ))
        self['lab1'] = Label('')

        self.playlists_all = jfunc.getPlaylistJson()

        self.onLayoutFinish.append(self.__layoutFinished)

        self['setupActions'] = ActionMap(
            ['SetupActions', 'ColorActions'], {
                'red': self.keyCancel,
                'green': self.deleteBouquets,
                'yellow': self.toggleAllSelection,
                'blue': self.clearAllSelection,
                'save': self.deleteBouquets,
                'cancel': self.keyCancel,
                'ok': self.toggleSelection
            }, -2)

        self.getStartList()
        self.refresh()
예제 #5
0
    def createSetup(self):
        self.list = []

        self.list.append((_('Playlists'), 'm_playlists'))
        self.list.append((_('Settings'), 'm_settings'))

        self.playlists_all = jfunc.getPlaylistJson()
        jglob.bouquets_exist = False
        for playlist in self.playlists_all:
            if 'bouquet_info' in playlist:
                jglob.bouquets_exist = True
                break

        if jglob.bouquets_exist:
            self.list.append((_('Update Bouquets'), 'm_update'))
            self.list.append((_('Delete Individual Bouquets'), 'm_delete_set'))
            self.list.append(
                (_('Delete All Jedi IPTV Bouquets'), 'm_delete_all'))

        self.list.append((_('About'), 'm_about'))

        self['menu'].list = self.list
        self['menu'].setList(self.list)
예제 #6
0
    def __init__(self, session, runtype):
        Screen.__init__(self, session)
        self.session = session
        self.runtype = runtype

        if os.path.isdir(
                '/usr/lib/enigma2/python/Plugins/Extensions/EPGImport'):
            jglob.has_epg_importer = True
            if not os.path.exists('/etc/epgimport'):
                os.makedirs('/etc/epgimport')
        else:
            jglob.has_epg_importer = False

        if self.runtype == 'manual':
            skin = skin_path + 'jmx_progress.xml'
            with open(skin, 'r') as f:
                self.skin = f.read()

        else:
            skin = """
				<screen name="Updater" position="0,0" size="1920,1080" backgroundColor="#ff000000" flags="wfNoBorder">
					<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/JediMakerXtream/icons/JediMakerXtreamFHD.png" position="30,25" size="150,60" alphatest="blend" zPosition="4"  />
					<eLabel position="180,30" size="360,50" backgroundColor="#10232323" transparent="0" zPosition="-1"/>
					<widget name="status" position="210,30" size="300,50" font="Regular;24" foregroundColor="#ffffff" backgroundColor="#000000" valign="center" noWrap="1" transparent="1" zPosition="5" />
				</screen>"""

            if screenwidth.width() <= 1280:
                skin = """
					<screen name="Updater" position="0,0" size="1280,720" backgroundColor="#ff000000" flags="wfNoBorder">
						<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/JediMakerXtream/icons/JediMakerXtream.png" position="20,16" size="100,40" alphatest="blend" zPosition="4" />
						<eLabel position="120,20" size="240,32" backgroundColor="#10232323" transparent="0" zPosition="-1"/>
						<widget name="status" position="140,20" size="200,32" font="Regular;16" foregroundColor="#ffffff" backgroundColor="#000000" valign="center" noWrap="1" transparent="1" zPosition="5" />
					</screen>"""

            self.skin = skin

        Screen.setTitle(self, _('Updating Bouquets'))

        self['action'] = Label('')
        self['status'] = Label('')
        self['progress'] = ProgressBar()
        self['actions'] = ActionMap(['SetupActions'],
                                    {'cancel': self.keyCancel}, -2)

        self.pause = 20
        self.job_bouquet_name = ''

        self.x = 0

        self.playlists_bouquets = []
        self.playlists_all = jfunc.getPlaylistJson()

        for playlist in self.playlists_all:
            if 'bouquet_info' in playlist:
                self.playlists_bouquets.append(playlist)

        self.progresscount = len(self.playlists_bouquets)

        self.progresscurrent = 0
        self['progress'].setRange((0, self.progresscount))
        self['progress'].setValue(self.progresscurrent)

        self.rytec_ref = {}
        self.epg_alias_names = []

        if self.playlists_bouquets != []:
            self.start()
        else:
            self.close()
예제 #7
0
	def makeBouquetData(self):
		
		jglob.current_playlist['bouquet_info'] = {}
		jglob.current_playlist['bouquet_info'] = OrderedDict([ 
		('bouquet_id', jglob.bouquet_id),
		('name', jglob.name),
		('oldname', jglob.old_name),
		('live_type', jglob.live_type),
		('vod_type', jglob.vod_type),
		('selected_live_categories', []),
		('selected_vod_categories', []),
		('selected_series_categories', []),
		('ignored_live_categories', []),
		('ignored_vod_categories', []),
		('ignored_series_categories', []),
		('live_update', '---'),
		('vod_update',  '---'),
		('series_update',  '---'),
		('xmltv_address', jglob.xmltv_address),
		('vod_order', jglob.vod_order),
		('epg_provider', jglob.epg_provider),
		('epg_rytec_uk', jglob.epg_rytec_uk),
		('epg_swap_names', jglob.epg_swap_names),
		('epg_force_rytec_uk', jglob.epg_force_rytec_uk),
		('prefix_name', jglob.prefix_name),
		 ])

		if jglob.live:
			jglob.current_playlist['bouquet_info']['live_update'] = datetime.now().strftime('%x  %X')
				
		if jglob.vod:
			jglob.current_playlist['bouquet_info']['vod_update'] = datetime.now().strftime('%x  %X')
			
		if jglob.series:
			jglob.current_playlist['bouquet_info']['series_update'] = datetime.now().strftime('%x  %X')
	
	
		if self.playlisttype == 'xtream':
			jglob.selectedcategories = self.getSelectionsList()
			
			for category in jglob.selectedcategories:
				if category[1] == 'Live':
					jglob.current_playlist['bouquet_info']['selected_live_categories'].append(category[0])
				elif category[1] == 'Series':
					jglob.current_playlist['bouquet_info']['selected_series_categories'].append(category[0])
				elif category[1] == 'VOD':
					jglob.current_playlist['bouquet_info']['selected_vod_categories'].append(category[0])
					
			jglob.ignoredcategories = self.getUnSelectedList()
			
			for category in jglob.ignoredcategories:
				if category[1] == 'Live':
					jglob.current_playlist['bouquet_info']['ignored_live_categories'].append(category[0])
				elif category[1] == 'Series':
					jglob.current_playlist['bouquet_info']['ignored_series_categories'].append(category[0])
				elif category[1] == 'VOD':
					jglob.current_playlist['bouquet_info']['ignored_vod_categories'].append(category[0])
					
			
		else:
			for category in jglob.getm3ustreams:
				if category[4] == 'live' and category[0] not in jglob.current_playlist['bouquet_info']['selected_live_categories']:
					jglob.current_playlist['bouquet_info']['selected_live_categories'].append(category[0])
				elif category[4] == 'vod' and category[0] not in jglob.current_playlist['bouquet_info']['selected_vod_categories']:
					jglob.current_playlist['bouquet_info']['selected_vod_categories'].append(category[0])
		
		self.playlists_all = jfunc.getPlaylistJson()
		
		for playlist in self.playlists_all:
			if playlist['playlist_info']['index'] == jglob.current_playlist['playlist_info']['index']:
				playlist['bouquet_info'] = jglob.current_playlist['bouquet_info']

				break
			
		with open(playlist_file, 'w') as f:
			json.dump(self.playlists_all, f)
예제 #8
0
 def refresh(self):
     self.playlists_all = jfunc.getPlaylistJson()
     self.removeBlanks()
     self.getPlaylistUserFile()
     self.createSetup()
예제 #9
0
    def loadPlaylist(self):

        if jglob.firstrun == 0:
            self.playlists_all = jfunc.getPlaylistJson()
            self.getPlaylistUserFile()
        self.createSetup()