def writeName(self): displayshow = config.plugins.vfdicon.displayshow.value if displayshow != "time" and displayshow != "date" and displayshow != "day_date": servicename = " " if displayshow != "nothing": service = self.session.nav.getCurrentlyPlayingServiceOrGroup() if service: path = service.getPath() if path: self.play = True servicename = "PLAY" currPlay = self.session.nav.getCurrentService() if currPlay != None and self.mp3Available: # show the MP3 tag servicename = currPlay.info().getInfoString( iServiceInformation.sTagTitle ) + "MP3" + currPlay.info().getInfoString( iServiceInformation.sTagArtist) else: # show the file name self.service = self.session.nav.getCurrentlyPlayingServiceReference( ) if not self.service is None: service = self.service.toCompareString() servicename = ServiceReference( service).getServiceName().replace( '\xc2\x87', '').replace('\xc2\x86', '').ljust(16) else: if displayshow == "channel_number" or displayshow == "channel_namenumber": servicename = str(service.getChannelNum()) if len(servicename) == 1: servicename = '000' + servicename elif len(servicename) == 2: servicename = '00' + servicename elif len(servicename) == 3: servicename = '0' + servicename if displayshow == "channel_namenumber": servicename = servicename + ' ' + ServiceReference( service).getServiceName() if displayshow == "channel": servicename = ServiceReference( service).getServiceName() if config.plugins.vfdicon.uppercase.value is not None: servicename = servicename.upper() if config.plugins.vfdicon.translit.value: servicename = translify(servicename) evfd.getInstance().vfd_write_string(servicename[0:63])
def WriteName(self): if config.plugins.vfdicon.displayshow.value != "clock": servicename = " " if config.plugins.vfdicon.displayshow.value != "blank": service = self.session.nav.getCurrentlyPlayingServiceOrGroup() if service: path = service.getPath() if path: servicename = "PLAY" else: if config.plugins.vfdicon.displayshow.value == "channel number": servicename = str(service.getChannelNum()) else: servicename = ServiceReference(service).getServiceName() if not DisplayType: servicename = translify(servicename) print "[VFD Display] text ", servicename[0:20] evfd.getInstance().vfd_write_string(servicename[0:20])
def _on_torrent_added(self, torrent_id): """called on torrent add event""" #get the torrent by torrent_id torrent = component.get("TorrentManager")[torrent_id] if torrent.get_status(["active_time"])["active_time"] > 2: return # torrent_name = torrent.get_status(["name"])["name"] torrent_comment = torrent.torrent_info.comment().decode("utf8", "ignore") if torrent_comment.startswith("http://rutracker.org/forum/viewtopic.php?t="): try: ulo = urllib2.urlopen(torrent_comment) except urllib2.URLError, e: print e.reason html_text = ulo.read().decode('cp1251') html_text_without_js = re.compile(r'<script[^>]+>.*?</script>', re.DOTALL).sub('', html_text.encode("utf-8")) parser = RutrackerParser() parser.feed(html_text_without_js.decode("utf-8")) parser.close() razdel_list = parser.get_razdelz() dest_path = "" for razdel in razdel_list: dest_path = os.path.join(dest_path, razdel) options = torrent.get_options() if options["move_completed"]: dest_path = os.path.join(options["move_completed_path"], dest_path) else: dest_path = os.path.join(options["download_location"], dest_path) print dest_path if self.config["translite"]: dest_path = translit.translify(dest_path.decode("utf-8")) if not os.path.exists(dest_path): os.makedirs(dest_path) torrent.set_move_completed(True) torrent.set_move_completed_path(dest_path)
def WriteName(self): if config.plugins.vfdicon.displayshow.value != "clock": servicename = " " if config.plugins.vfdicon.displayshow.value != "blank": service = self.session.nav.getCurrentlyPlayingServiceOrGroup() if service: path = service.getPath() if path: servicename = "PLAY" else: if config.plugins.vfdicon.displayshow.value == "channel number": servicename = str(service.getChannelNum()) else: servicename = ServiceReference( service).getServiceName() if not DisplayType: servicename = translify(servicename) print "[VFD Display] text ", servicename[0:20] evfd.getInstance().vfd_write_string(servicename[0:20])
def translateName(self, input): outStr = translit.translify(input) outStr = outStr.strip() print "[translatedName]", outStr self.tr_servicename = outStr;
def to_translit(x): return translify(x).replace(' ', '_')