Changeset 7057 for ipk/source
- Timestamp:
- Apr 7, 2011, 11:19:16 PM (15 years ago)
- Location:
- ipk/source/swapmediacenter_mediathek_2_7
- Files:
-
- 2 edited
- 1 moved
-
. (moved) (moved from ipk/source/swapmediacenter_mediathek_2_5 )
-
CONTROL/control (modified) (1 diff)
-
var/swap/extensions/MultiMediathek/plugin.py (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ipk/source/swapmediacenter_mediathek_2_7/CONTROL/control
r6925 r7057 1 1 Package: enigma2-plugin-swapmediacenter-multimediathek 2 Version: 2. 52 Version: 2.7 3 3 Architecture: sh4 4 4 OE: MultiMediathek -
ipk/source/swapmediacenter_mediathek_2_7/var/swap/extensions/MultiMediathek/plugin.py
r6927 r7057 3 3 # Coded by Homey (c) 2011 4 4 # 5 # Version: 2. 55 # Version: 2.7 6 6 # Support: www.i-have-a-dreambox.com 7 7 ##################################################### … … 35 35 from time import time 36 36 from twisted.web.client import getPage, downloadPage 37 from urllib import urlencode, unquote 37 from urllib import urlencode, unquote, quote_plus 38 38 from urllib2 import Request, urlopen 39 39 from xml.dom.minidom import parse, parseString … … 60 60 config.plugins.multimediathek.showadultcontent = ConfigYesNo(default=False) 61 61 config.plugins.multimediathek.showsecretcontent = ConfigYesNo(default=False) 62 config.plugins.multimediathek.checkforupdate = ConfigYesNo(default= True)63 config.plugins.multimediathek.version = NoSave(ConfigText(default="2 50"))62 config.plugins.multimediathek.checkforupdate = ConfigYesNo(default=False) 63 config.plugins.multimediathek.version = NoSave(ConfigText(default="270")) 64 64 65 65 ################################# … … 69 69 class downloadJob(Job): 70 70 def __init__(self, toolbox, cmdline, filename, filetitle): 71 Job.__init__(self, _(" Saving Movie from Mediathek"))71 Job.__init__(self, _("Download Movie")) 72 72 self.toolbox = toolbox 73 73 self.retrycount = 0 … … 211 211 size_w = getDesktop(0).size().width() 212 212 size_h = getDesktop(0).size().height() 213 self.FramebufferScale = AVSwitch().getFramebufferScale()214 213 215 214 if size_w == 1280: … … 310 309 self["thumb"+str(x)] = Pixmap() 311 310 311 # Get FrameBuffer Scale for ePicLoad() 312 sc = AVSwitch().getFramebufferScale() 313 314 # Init Thumb PicLoad 312 315 self.picload = ePicLoad() 313 self.picload.PictureData.get().append(self.showPic) 314 315 self.ThumbTimer = eTimer() 316 self.ThumbTimer.callback.append(self.showPic) 317 318 # Init Thumb PicLoad 319 self.thumbload = ePicLoad() 320 self.thumbload.PictureData.get().append(self.showThumbPixmap) 321 self.thumbload.setPara((self.picX-10, self.picY-(textsize*2), self.FramebufferScale[0], self.FramebufferScale[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000")) 316 self.picload.PictureData.get().append(self.showThumbPixmap) 317 self.picload.setPara((self.picX-10, self.picY-(textsize*2), sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000")) 322 318 323 319 # Init eBackgroundFileEraser … … 331 327 332 328 def loadFrame(self): 333 if not self.createMediaFolders(): 334 return 329 if self.feedtitle == "Startseite": 330 if not self.createMediaFolders(): 331 return 335 332 336 333 if self.feedtitle == "Bookmarks": … … 340 337 341 338 def createMediaFolders(self): 342 #if self.feedtitle == "Startseite" and not os_path.ismount(config.plugins.multimediathek.storagepath.value): 343 # self["pageinfo"].setText(_("ERROR creating mediathek folders ...")) 344 # return False 345 346 if self.feedtitle == "Startseite" and os_path.ismount(config.plugins.multimediathek.storagepath.value): 347 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek") 348 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/images") 349 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/movies") 350 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/tmp") 351 352 return True 339 # Check if cache folder is on a mountable device and not inside flash-memory 340 tmppath = config.plugins.multimediathek.storagepath.value 341 while not os_path.ismount(tmppath): 342 tmppath = os_path.dirname(tmppath) 343 if tmppath == "/": 344 self["pageinfo"].setText(_("Error: Can not create cache-folders inside flash memory. Check your Cache-Folder Settings!")) 345 return False 346 347 # Create Cache Folders ... 348 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek") 349 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/images") 350 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/movies") 351 os_system("mkdir -p "+config.plugins.multimediathek.storagepath.value+"/mediathek/tmp") 352 353 # Check if Cache Folders were created successfully 354 if not os_path.exists(config.plugins.multimediathek.storagepath.value+"/mediathek"): 355 self["pageinfo"].setText(_("Error: No write permission to create cache-folders. Check your Cache-Folder Settings!")) 356 return False 357 else: 358 return True 353 359 354 360 def checkforupdate(self): … … 493 499 self.gotThumbnail() 494 500 else: 495 downloadPage(self.thumburl, self.thumbfile).addCallback(self.gotThumbnail).addErrback(self.showThumbError) 496 497 def gotThumbnail(self, txt=""): 498 if self.thumbload.getThumbnail(self.thumbfile) == 1: 499 if self.thumbcount+1 < len(self.Thumbnaillist): 500 self.getThumbnail() 501 downloadPage(self.thumburl, self.thumbfile, agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2").addCallback(self.gotThumbnail).addErrback(self.showThumbError) 502 503 def gotThumbnail(self, data=""): 504 self.picload.startDecode(self.thumbfile) 501 505 502 506 def showThumbPixmap(self, picInfo=None): 503 ptr = self. thumbload.getData()507 ptr = self.picload.getData() 504 508 if ptr != None: 505 509 self["thumb" + str(self.thumbcount)].instance.setPixmap(ptr.__deref__()) … … 549 553 self.getThumbnail() 550 554 551 def showPic(self, picInfo=""):552 for x in range(len(self.Thumbnaillist)):553 if self.Thumbnaillist[x][0] == 0:554 if self.picload.getThumbnail(self.Thumbnaillist[x][2]) == 1:555 self.ThumbTimer.start(500, True)556 else:557 self.Thumbnaillist[x][0] = 1558 break559 elif self.Thumbnaillist[x][0] == 1:560 self.Thumbnaillist[x][0] = 2561 ptr = self.picload.getData()562 if ptr != None:563 self["thumb" + str(self.Thumbnaillist[x][1])].instance.setPixmap(ptr.__deref__())564 self["thumb" + str(self.Thumbnaillist[x][1])].show()565 566 555 def selectBookmark(self): 567 556 self.session.open(MultiMediathek, self.itemlist[self.index][5], "Bookmarks", "Bookmarks from your favorite Movies") … … 600 589 self.session.openWithCallback(self.loadFrame, MultiMediathek_Settings) 601 590 elif self.itemlist: 602 self.session.openWithCallback(self.loadFrame, MultiMediathek_ ItemOptions, self.itemlist[self.index])591 self.session.openWithCallback(self.loadFrame, MultiMediathek_MenuOptions, self.itemlist[self.index]) 603 592 604 593 def key_ok(self): … … 610 599 elif self.itemlist[self.index][6] == "movie": 611 600 self.session.open(MovieInfoScreen, self.itemlist[self.index][5]) 601 elif self.itemlist[self.index][6] == "switchpage": 602 self.feedurl = self.itemlist[self.index][5] 603 self.index = 0 604 self.getxmlfeed() 612 605 elif self.itemlist[self.index][6] == "search": 613 606 self.searchurl = self.itemlist[self.index][5] … … 616 609 def SendSearchQuery(self, query): 617 610 if query is not None: 618 searchurl = self.itemlist[self.index][5] + "&searchquery=" + str(query)611 searchurl = self.itemlist[self.index][5] + "&searchquery=" + quote_plus(str(query)) 619 612 self.session.open(MultiMediathek, searchurl, self.itemlist[self.index][3], self.feedtext + " - " + self.itemlist[self.index][3] + ": " + query) 620 613 … … 638 631 self.BgFileEraser.erase(filelocation) 639 632 633 del self.picload 640 634 self.close() 641 635 … … 716 710 }, -1) 717 711 712 # Get FrameBuffer Scale for ePicLoad() 713 sc = AVSwitch().getFramebufferScale() 714 715 # Init ePicLoad 716 self.picload = ePicLoad() 717 self.picload.PictureData.get().append(self.showPosterPixmap) 718 self.picload.setPara((270, 350, sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000")) 719 718 720 self.onFirstExecBegin.append(self.GetMovieInfo) 719 721 … … 770 772 771 773 # Download Image 772 downloadPage(self.movieinfo[3], self.imagefolder+"/poster.jpg" ).addCallback(self.downloadPosterCallback)774 downloadPage(self.movieinfo[3], self.imagefolder+"/poster.jpg", agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2").addCallback(self.downloadPosterCallback) 773 775 774 776 def downloadPosterCallback(self, txt=""): 775 sc = AVSwitch().getFramebufferScale()776 self.picload = ePicLoad()777 self.picload.PictureData.get().append(self.showPosterPixmap)778 self.picload.setPara((270, 350, sc[0], sc[1], config.plugins.multimediathek.imagecache.value, int(config.plugins.multimediathek.imagescaling.value), "#00000000"))779 777 self.picload.startDecode(self.imagefolder+"/poster.jpg") 780 778 … … 945 943 946 944 def Exit(self): 945 del self.picload 947 946 self.close() 948 947 … … 1153 1152 #------------------------------------------------------------------------------------------ 1154 1153 1155 class MultiMediathek_ ItemOptions(Screen):1154 class MultiMediathek_MenuOptions(Screen): 1156 1155 def __init__(self, session, movieinfo): 1157 1156 Screen.__init__(self, session) 1158 1157 1159 1158 self.skin = """ 1160 <screen position="center,center" size="400,200" title="Mediathek - ItemOptions">1159 <screen position="center,center" size="400,200" title="Mediathek - Menu Options"> 1161 1160 <widget source="itemname" transparent="1" render="Label" zPosition="2" position="10,180" size="380,20" font="Regular;16" /> 1162 1161 <widget source="menu" render="Listbox" zPosition="5" transparent="1" position="10,10" size="380,160" scrollbarMode="showOnDemand" > … … 1168 1167 self.movieinfo = movieinfo 1169 1168 if self.movieinfo[7] == "bookmark": 1170 list.append(("Delete thisbookmark", "delbookmark", "menu_delbookmark", "50"))1169 list.append(("Delete selected bookmark", "delbookmark", "menu_delbookmark", "50")) 1171 1170 elif self.movieinfo[6] == "movie": 1172 list.append(("Bookmark thismovie", "addbookmark", "menu_addbookmark", "50"))1171 list.append(("Bookmark selected movie", "addbookmark", "menu_addbookmark", "50")) 1173 1172 elif self.movieinfo[6] == "cat": 1174 list.append(("Bookmark thiscategory", "addbookmark", "menu_addbookmark", "50"))1173 list.append(("Bookmark selected category", "addbookmark", "menu_addbookmark", "50")) 1175 1174 list.append(("View Bookmarks", "viewbookmarks", "menu_viewbookmarks", "50")) 1175 list.append(("View Downloads", "viewdownloads", "menu_viewdownloads", "50")) 1176 1176 list.append(("Mediathek Settings", "settingsmenu", "menu_settings", "50")) 1177 1177 … … 1190 1190 if selection[1] == "addbookmark": 1191 1191 os_system("echo '%s:::%s:::%s:::%s' >> /etc/enigma2/multimediathek.bookmarks" % (self.movieinfo[6], self.movieinfo[3], self.movieinfo[5], self.movieinfo[4])) 1192 #self.session.openWithCallback(self.Exit, MessageBox, _("Bookmark added!"), MessageBox.TYPE_INFO, timeout=5)1193 1192 self.Exit() 1194 1193 if selection[1] == "delbookmark": … … 1203 1202 tmpfile.close() 1204 1203 os_system("echo '%s' > %s" % (tmpdata,bookmarkfile)) 1205 1206 #self.session.openWithCallback(self.Exit, MessageBox, _("Bookmark deleted!"), MessageBox.TYPE_INFO, timeout=5)1207 1204 self.Exit() 1208 1205 elif selection[1] == "viewbookmarks": 1209 1206 self.session.open(MultiMediathek, self.movieinfo[5], "Bookmarks", "Bookmarks from your favorite Movies") 1207 elif selection[1] == "viewdownloads": 1208 self.session.openWithCallback(self.Exit, MultiMediathek_TaskViewer) 1210 1209 elif selection[1] == "settingsmenu": 1211 1210 self.session.openWithCallback(self.Exit, MultiMediathek_Settings) … … 1216 1215 1217 1216 def Exit(self, retval=None): 1217 self.close() 1218 1219 1220 #------------------------------------------------------------------------------------------ 1221 1222 1223 class MultiMediathek_TaskViewer(Screen): 1224 def __init__(self, session): 1225 Screen.__init__(self, session) 1226 self.session = session 1227 1228 self.skin = """ 1229 <screen name="MediathekTasksScreen" position="center,center" size="700,550" title="Mediathek - Active Downloads"> 1230 <widget source="tasklist" render="Listbox" position="30,120" size="640,370" zPosition="7" scrollbarMode="showOnDemand" transparent="1" > 1231 <convert type="TemplatedMultiContent"> 1232 {"template": [ 1233 MultiContentEntryText(pos = (0, 1), size = (200, 24), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the name 1234 MultiContentEntryText(pos = (210, 1), size = (150, 24), font=1, flags = RT_HALIGN_RIGHT, text = 2), # index 2 is the state 1235 MultiContentEntryProgress(pos = (370, 1), size = (100, 24), percent = -3), # index 3 should be progress 1236 MultiContentEntryText(pos = (480, 1), size = (100, 24), font=1, flags = RT_HALIGN_RIGHT, text = 4), # index 4 is the percentage 1237 ], 1238 "fonts": [gFont("Regular", 22),gFont("Regular", 18)], 1239 "itemHeight": 25 1240 } 1241 </convert> 1242 </widget> 1243 <ePixmap position="220,500" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" /> 1244 <widget name="key_red" position="220,500" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" /> 1245 </screen>""" 1246 1247 self["shortcuts"] = ActionMap(["SetupActions", "ColorActions"], 1248 { 1249 "ok": self.keyOK, 1250 "cancel": self.keyClose, 1251 "red": self.keyClose 1252 }, -1) 1253 1254 self["tasklist"] = List([]) 1255 self["key_red"] = Button(_("Close")) 1256 1257 self.Timer = eTimer() 1258 self.Timer.callback.append(self.TimerFire) 1259 1260 self.onLayoutFinish.append(self.layoutFinished) 1261 self.onClose.append(self.__onClose) 1262 1263 def __onClose(self): 1264 del self.Timer 1265 1266 def layoutFinished(self): 1267 self.Timer.startLongTimer(2) 1268 1269 def TimerFire(self): 1270 self.Timer.stop() 1271 self.rebuildTaskList() 1272 1273 def rebuildTaskList(self): 1274 self.tasklist = [] 1275 for job in JobManager.getPendingJobs(): 1276 self.tasklist.append((job, job.name, job.getStatustext(), int(100*job.progress/float(job.end)) ,str(100*job.progress/float(job.end)) + "%" )) 1277 self['tasklist'].setList(self.tasklist) 1278 self['tasklist'].updateList(self.tasklist) 1279 self.Timer.startLongTimer(2) 1280 1281 def keyOK(self): 1282 current = self["tasklist"].getCurrent() 1283 if current: 1284 job = current[0] 1285 self.session.openWithCallback(self.JobViewCB, JobView, job) 1286 1287 def JobViewCB(self, why): 1288 pass 1289 1290 def keyClose(self): 1218 1291 self.close() 1219 1292
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/openaaf/chrome/common/titannit_trac_banner.png)