Changeset 1885
- Timestamp:
- 16/11/08 18:51:46 (8 weeks ago)
- svm:headrev:
cc3e1ea1-1e01-0410-8d68-8b121e83a9d5:11167- Location:
- freevo/src
- Files:
-
- 16 modified
-
audio/plugins/detachbar.py (modified) (1 diff)
-
directory.py (modified) (1 diff)
-
image/viewer.py (modified) (1 diff)
-
plugins/idlebar/weather.py (modified) (1 diff)
-
plugins/lcd.py (modified) (1 diff)
-
plugins/processevent.py (modified) (1 diff)
-
plugins/rom_drives.py (modified) (2 diffs)
-
plugins/speak.py (modified) (1 diff)
-
plugins/udpremote.py (modified) (1 diff)
-
plugins/vfd.py (modified) (1 diff)
-
tv/plugins/genre.py (modified) (2 diffs)
-
tv/plugins/recordings_manager.py (modified) (2 diffs)
-
util/feedparser.py (modified) (81 diffs)
-
util/youtube_dl.py (modified) (2 diffs)
-
video/__init__.py (modified) (1 diff)
-
video/plugins/mplayer.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
freevo/src/audio/plugins/detachbar.py
r1883 r1885 83 83 84 84 | digraph finite_state_machine { 85 | rankdir=TB;86 | size="8,5"87 | node [shape = doublecircle]; Hide;88 | node [shape = circle];89 | { rank = same; "Wait"; "Show"; }90 | Hide -> Show [ label = "detach(start timer)" ];91 | Show -> Wait [ label = "play_end" ];92 | Show -> Hide [ label = "stop(stop timer)" ];93 | Wait -> Hide [ label = "stop(stop timer)" ];94 | Show -> Show [ label = "play_start" ];95 | Wait -> Show [ label = "play_start" ];96 | Wait -> Hide [ label = "timeout(stop timer)" ];85 | rankdir=TB; 86 | size="8,5" 87 | node [shape = doublecircle]; Hide; 88 | node [shape = circle]; 89 | { rank = same; "Wait"; "Show"; } 90 | Hide -> Show [ label = "detach(start timer)" ]; 91 | Show -> Wait [ label = "play_end" ]; 92 | Show -> Hide [ label = "stop(stop timer)" ]; 93 | Wait -> Hide [ label = "stop(stop timer)" ]; 94 | Show -> Show [ label = "play_start" ]; 95 | Wait -> Show [ label = "play_start" ]; 96 | Wait -> Hide [ label = "timeout(stop timer)" ]; 97 97 | } 98 98 """ -
freevo/src/directory.py
r1773 r1885 84 84 _('Show the items in the list in reverse order.'), False), 85 85 86 ('DIRECTORY_AUDIO_FORMAT_STRING', '', '', False), 86 ('DIRECTORY_AUDIO_FORMAT_STRING', '', '', False), 87 87 88 88 ('DIRECTORY_CREATE_PLAYLIST', _('Directory Create Playlist'), -
freevo/src/image/viewer.py
r1719 r1885 481 481 if strtag[1] == 'date' and self.fileitem['timestamp']: 482 482 osdstring.append('%s %s' % (strtag[0], datetime.datetime.fromtimestamp(self.fileitem['timestamp']))) 483 483 484 484 # If after all that there is nothing then tell the users that 485 485 if osdstring == []: -
freevo/src/plugins/idlebar/weather.py
r1772 r1885 195 195 else: 196 196 image_x = ((text_w - image_w) / 2) 197 text_x = 0 197 text_x = 0 198 198 image_y = osd.y + 7 199 199 text_y = osd.y + 55 - text_h -
freevo/src/plugins/lcd.py
r1794 r1885 643 643 # Check if audio is detached 644 644 # When in detached mode, do not draw the player screen 645 if type == 'player': 645 if type == 'player': 646 646 if plugin.getbyname('audio.detachbar'): 647 647 if plugin.getbyname('audio.detachbar').state != 1: #BAR_HIDE -
freevo/src/plugins/processevent.py
r1800 r1885 63 63 print '%s event_handler(%s) %s' % (time.strftime('%H:%M:%S'), event, event.__dict__) 64 64 return True 65 -
freevo/src/plugins/rom_drives.py
r1768 r1885 68 68 CDROM_SELECT_SPEED = 0x5322 # Set the CD-ROM speed 69 69 CDROM_SELECT_DISC = 0x5323 # Select disc (for juke-boxes) 70 CDROM_MEDIA_CHANGED = 0x5325 # Check is media changed 70 CDROM_MEDIA_CHANGED = 0x5325 # Check is media changed 71 71 CDROM_DRIVE_STATUS = 0x5326 # Get tray position, etc. 72 72 CDROM_DISC_STATUS = 0x5327 # Get disc type, etc. … … 83 83 # capability flags 84 84 CDC_CLOSE_TRAY = 0x1 # caddy systems _can't_ close 85 CDC_OPEN_TRAY = 0x2 # but _can_ eject. 85 CDC_OPEN_TRAY = 0x2 # but _can_ eject. 86 86 CDC_LOCK = 0x4 # disable manual eject 87 87 CDC_SELECT_SPEED = 0x8 # programmable speed -
freevo/src/plugins/speak.py
r1709 r1885 56 56 57 57 | plugin.activate('speak') 58 58 59 59 Additionally you can customize the messages spoken upon startup and shutdown of Freevo by setting 60 60 -
freevo/src/plugins/udpremote.py
r1795 r1885 130 130 if self.disable: return 131 131 132 if type == 'player': 132 if type == 'player': 133 133 if plugin.getbyname('audio.detachbar'): 134 134 if plugin.getbyname('audio.detachbar').state != 1: #BAR_HIDE -
freevo/src/plugins/vfd.py
r1795 r1885 592 592 # Check if audio is detached 593 593 # When in detached mode, do not draw the player screen 594 if type == 'player': 594 if type == 'player': 595 595 if plugin.getbyname('audio.detachbar'): 596 596 if plugin.getbyname('audio.detachbar').state != 1: #BAR_HIDE -
freevo/src/tv/plugins/genre.py
r1718 r1885 106 106 def actions(self): 107 107 return [ (self.browse, _('Browse list'))] 108 109 108 109 110 110 def browse(self, arg=None, menuw=None): 111 """ 111 """ 112 112 Find all genres/categories 113 113 """ … … 132 132 categories.append(genre) 133 133 items.append(GenreItem(self.parent, genre)) 134 134 135 135 # create menu 136 136 menu = Menu(self.name, items, item_types='tv listing') 137 137 menuw.pushmenu(menu) 138 138 menuw.refresh() 139 139 140 140 141 141 -
freevo/src/tv/plugins/recordings_manager.py
r1809 r1885 901 901 filename == rpitem.files.edl_file or \ 902 902 filename == rpitem.files.image: 903 # just in case only some of the item files have been deleted, add the 904 # existing ones back into the added files so a new item is created for 903 # just in case only some of the item files have been deleted, add the 904 # existing ones back into the added files so a new item is created for 905 905 # those files. 906 906 for itemfile in rpitem.files.files + [rpitem.files.fxd_file, rpitem.files.edl_file, rpitem.files.image]: … … 918 918 919 919 rpitem_time = time.time() 920 920 921 921 # Add the new recordings 922 922 for recorded_item in added_recordings: -
freevo/src/util/feedparser.py
r1776 r1885 142 142 # reversable htmlentitydefs mappings for Python 2.2 143 143 try: 144 from htmlentitydefs import name2codepoint, codepoint2name144 from htmlentitydefs import name2codepoint, codepoint2name 145 145 except: 146 import htmlentitydefs147 name2codepoint={}148 codepoint2name={}149 for (name,codepoint) in htmlentitydefs.entitydefs.iteritems():150 if codepoint.startswith('&#'): codepoint=unichr(int(codepoint[2:-1]))151 name2codepoint[name]=ord(codepoint)152 codepoint2name[ord(codepoint)]=name146 import htmlentitydefs 147 name2codepoint={} 148 codepoint2name={} 149 for (name,codepoint) in htmlentitydefs.entitydefs.iteritems(): 150 if codepoint.startswith('&#'): codepoint=unichr(int(codepoint[2:-1])) 151 name2codepoint[name]=ord(codepoint) 152 codepoint2name[ord(codepoint)]=name 153 153 154 154 # BeautifulSoup parser used for parsing microformats from embedded HTML content … … 268 268 self[key] = value 269 269 return self[key] 270 270 271 271 def has_key(self, key): 272 272 try: … … 274 274 except AttributeError: 275 275 return False 276 276 277 277 def __getattr__(self, key): 278 278 try: … … 330 330 ''.join(map(chr, range(256))), ''.join(map(chr, emap))) 331 331 return s.translate(_ebcdic_to_ascii_map) 332 332 333 333 _cp1252 = { 334 334 unichr(128): unichr(8364), # euro sign … … 383 383 'http://www.w3.org/2005/Atom': '', 384 384 'http://purl.org/rss/1.0/modules/rss091#': '', 385 385 386 386 'http://webns.net/mvcb/': 'admin', 387 387 'http://purl.org/rss/1.0/modules/aggregation/': 'ag', … … 438 438 can_contain_dangerous_markup = ['content', 'title', 'summary', 'info', 'tagline', 'subtitle', 'copyright', 'rights', 'description'] 439 439 html_types = ['text/html', 'application/xhtml+xml'] 440 440 441 441 def __init__(self, baseuri=None, baselang=None, encoding='utf-8'): 442 442 if _debug: sys.stderr.write('initializing FeedParser\n') … … 480 480 attrs = [(k.lower(), v) for k, v in attrs] 481 481 attrs = [(k, k in ('rel', 'type') and v.lower() or v) for k, v in attrs] 482 482 483 483 # track xml:base and xml:lang 484 484 attrsD = dict(attrs) … … 503 503 self.basestack.append(self.baseuri) 504 504 self.langstack.append(lang) 505 505 506 506 # track namespaces 507 507 for prefix, uri in attrs: … … 541 541 if (not prefix) and tag not in ('title', 'link', 'description', 'url', 'href', 'width', 'height'): 542 542 self.inimage = 0 543 543 544 544 # call special handler (if defined) or default handler 545 545 methodname = '_start_' + prefix + suffix … … 660 660 contentType = 'application/xhtml+xml' 661 661 return contentType 662 662 663 663 def trackNamespace(self, prefix, uri): 664 664 loweruri = uri.lower() … … 681 681 def resolveURI(self, uri): 682 682 return _urljoin(self.baseuri or '', uri) 683 683 684 684 def decodeEntities(self, element, data): 685 685 return data … … 694 694 if not self.elementstack: return 695 695 if self.elementstack[-1][0] != element: return 696 696 697 697 element, expectingText, pieces = self.elementstack.pop() 698 698 … … 730 730 except binascii.Incomplete: 731 731 pass 732 732 733 733 # resolve relative URIs 734 734 if (element in self.can_be_relative_uri) and output: 735 735 output = self.resolveURI(output) 736 736 737 737 # decode entities within embedded markup 738 738 if not self.contentparams.get('base64', 0): … … 757 757 if element in self.can_contain_relative_uris: 758 758 output = _resolveRelativeURIs(output, self.baseuri, self.encoding, self.contentparams.get('type', 'text/html')) 759 759 760 760 # parse microformats 761 761 # (must do this before sanitizing because some microformats … … 773 773 if vcard: 774 774 self._getContext()['vcard'] = vcard 775 775 776 776 # sanitize embedded markup 777 777 if is_htmlish and SANITIZE_HTML: … … 803 803 if element == 'title' and self.hasTitle: 804 804 return output 805 805 806 806 # store output in appropriate place(s) 807 807 if self.inentry and not self.insource: … … 851 851 self.contentparams.clear() 852 852 return value 853 853 854 854 # a number of elements in a number of RSS variants are nominally plain 855 855 # text, but this is routinely ignored. This is an attempt to detect … … 882 882 name = prefix + ':' + suffix 883 883 return name 884 884 885 885 def _getAttribute(self, attrsD, name): 886 886 return attrsD.get(self._mapToStandardPrefix(name)) … … 910 910 attrsD['href'] = href 911 911 return attrsD 912 912 913 913 def _save(self, key, value): 914 914 context = self._getContext() … … 929 929 else: 930 930 self.version = 'rss' 931 931 932 932 def _start_dlhottitles(self, attrsD): 933 933 self.version = 'hotrss' … … 947 947 self.elementstack[-1][-1] = attrsD['href'] 948 948 self._end_link() 949 949 950 950 def _start_feed(self, attrsD): 951 951 self.infeed = 1 … … 964 964 self.infeed = 0 965 965 _end_feed = _end_channel 966 966 967 967 def _start_image(self, attrsD): 968 968 context = self._getContext() … … 971 971 self.hasTitle = 0 972 972 self.push('image', 0) 973 973 974 974 def _end_image(self): 975 975 self.pop('image') … … 983 983 self.push('textinput', 0) 984 984 _start_textInput = _start_textinput 985 985 986 986 def _end_textinput(self): 987 987 self.pop('textinput') … … 1177 1177 _end_tagline = _end_subtitle 1178 1178 _end_itunes_subtitle = _end_subtitle 1179 1179 1180 1180 def _start_rights(self, attrsD): 1181 1181 self.pushContent('rights', attrsD, 'text/plain', 1) … … 1273 1273 if value: attrsD['href']=value 1274 1274 context.setdefault('links', []).append(attrsD) 1275 1275 1276 1276 def _start_creativecommons_license(self, attrsD): 1277 1277 self.push('license', 1) … … 1294 1294 if value not in xfn: 1295 1295 xfn.append(value) 1296 1296 1297 1297 def _addTag(self, term, scheme, label): 1298 1298 context = self._getContext() … … 1312 1312 _start_dc_subject = _start_category 1313 1313 _start_keywords = _start_category 1314 1314 1315 1315 def _end_itunes_keywords(self): 1316 1316 for term in self.pop('itunes_keywords').split(): 1317 1317 self._addTag(term, 'http://www.itunes.com/', None) 1318 1318 1319 1319 def _start_itunes_category(self, attrsD): 1320 1320 self._addTag(attrsD.get('text'), 'http://www.itunes.com/', None) 1321 1321 self.push('category', 1) 1322 1322 1323 1323 def _end_category(self): 1324 1324 value = self.pop('category') … … 1336 1336 def _start_cloud(self, attrsD): 1337 1337 self._getContext()['cloud'] = FeedParserDict(attrsD) 1338 1338 1339 1339 def _start_link(self, attrsD): 1340 1340 attrsD.setdefault('rel', 'alternate') … … 1438 1438 if context.has_key('generator_detail'): 1439 1439 context['generator_detail']['name'] = value 1440 1440 1441 1441 def _start_admin_generatoragent(self, attrsD): 1442 1442 self.push('generator', 1) … … 1453 1453 self.elementstack[-1][2].append(value) 1454 1454 self.pop('errorreportsto') 1455 1455 1456 1456 def _start_summary(self, attrsD): 1457 1457 context = self._getContext() … … 1471 1471 self._summaryKey = None 1472 1472 _end_itunes_summary = _end_summary 1473 1473 1474 1474 def _start_enclosure(self, attrsD): 1475 1475 attrsD = self._itsAnHrefDamnIt(attrsD) … … 1480 1480 if href and not context.get('id'): 1481 1481 context['id'] = href 1482 1482 1483 1483 def _start_source(self, attrsD): 1484 1484 self.insource = 1 … … 1524 1524 self._getContext()['image'] = FeedParserDict({'href': attrsD.get('href')}) 1525 1525 _start_itunes_link = _start_itunes_image 1526 1526 1527 1527 def _end_itunes_block(self): 1528 1528 value = self.pop('itunes_block', 0) … … 1541 1541 self.bozo = 0 1542 1542 self.exc = None 1543 1543 1544 1544 def startPrefixMapping(self, prefix, uri): 1545 1545 self.trackNamespace(prefix, uri) 1546 1546 1547 1547 def startElementNS(self, name, qname, attrs): 1548 1548 namespace, localname = name … … 1558 1558 prefix = self._matchnamespaces.get(lowernamespace, givenprefix) 1559 1559 if givenprefix and (prefix == None or (prefix == '' and lowernamespace == '')) and not self.namespacesInUse.has_key(givenprefix): 1560 raise UndeclaredNamespace, "'%s' is not associated with a namespace" % givenprefix1560 raise UndeclaredNamespace, "'%s' is not associated with a namespace" % givenprefix 1561 1561 localname = str(localname).lower() 1562 1562 … … 1578 1578 elif namespace and not qname: #Expat 1579 1579 for name,value in self.namespacesInUse.items(): 1580 if name and value == namespace:1581 localname = name + ':' + localname1582 break1580 if name and value == namespace: 1581 localname = name + ':' + localname 1582 break 1583 1583 if _debug: sys.stderr.write('startElementNS: qname = %s, namespace = %s, givenprefix = %s, prefix = %s, attrs = %s, localname = %s\n' % (qname, namespace, givenprefix, prefix, attrs.items(), localname)) 1584 1584 … … 1608 1608 elif namespace and not qname: #Expat 1609 1609 for name,value in self.namespacesInUse.items(): 1610 if name and value == namespace:1611 localname = name + ':' + localname1612 break1610 if name and value == namespace: 1611 localname = name + ':' + localname 1612 break 1613 1613 localname = str(localname).lower() 1614 1614 self.unknown_endtag(localname) … … 1617 1617 self.bozo = 1 1618 1618 self.exc = exc 1619 1619 1620 1620 def fatalError(self, exc): 1621 1621 self.error(exc) … … 1627 1627 elements_no_end_tag = ['area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 1628 1628 'img', 'input', 'isindex', 'link', 'meta', 'param'] 1629 1629 1630 1630 def __init__(self, encoding, type): 1631 1631 self.encoding = encoding … … 1633 1633 if _debug: sys.stderr.write('entering BaseHTMLProcessor, encoding=%s\n' % self.encoding) 1634 1634 sgmllib.SGMLParser.__init__(self) 1635 1635 1636 1636 def reset(self): 1637 1637 self.pieces = [] … … 1655 1655 data = re.compile(r'<!((?!DOCTYPE|--|\[))', re.IGNORECASE).sub(r'<!\1', data) 1656 1656 #data = re.sub(r'<(\S+?)\s*?/>', self._shorttag_replace, data) # bug [ 1399464 ] Bad regexp for _shorttag_replace 1657 data = re.sub(r'<([^<\s]+?)\s*/>', self._shorttag_replace, data) 1657 data = re.sub(r'<([^<\s]+?)\s*/>', self._shorttag_replace, data) 1658 1658 data = data.replace(''', "'") 1659 1659 data = data.replace('"', '"') … … 1718 1718 else: 1719 1719 self.pieces.append('&#%(ref)s;' % locals()) 1720 1720 1721 1721 def handle_entityref(self,
