-
Notifications
You must be signed in to change notification settings - Fork 3
/
plugin.py
12483 lines (11566 loc) · 569 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 20221004 Kiddac edit: python 3 support et al
# 20221204 Lululla edit & add: language, config, major fix
# 20221208 Twol add ......callInThread ....getMountDefault
# 20221222 Lululla recoded, major fix
from __future__ import print_function
from . import _
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
# from Components.FileList import FileList
# from Components.Harddisk import harddiskmanager
from Components.Label import Label
from Components.Language import language
from Components.MenuList import MenuList
from Components.MultiContent import MultiContentEntryPixmapAlphaTest
from Components.MultiContent import MultiContentEntryText
from Components.Pixmap import Pixmap, MultiPixmap
from Components.ProgressBar import ProgressBar
from Components.ScrollLabel import ScrollLabel
from Components.ServiceEventTracker import ServiceEventTracker
from Components.config import ConfigSelection, ConfigText, ConfigYesNo
from Components.config import ConfigDirectory
from Components.config import ConfigSlider
from Components.config import ConfigEnableDisable
from Components.config import ConfigSubsection, ConfigOnOff
from Components.config import config, configfile, ConfigClock
from Components.config import NoSave, getConfigListEntry
from Components.Sources.StaticText import StaticText
from Plugins.Plugin import PluginDescriptor
from Screens.ChannelSelection import ChannelSelection
from Screens.ChoiceBox import ChoiceBox
from Screens.InfoBar import MoviePlayer
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Tools.Directories import fileExists
from enigma import RT_HALIGN_CENTER, RT_VALIGN_CENTER # , RT_WRAP
from enigma import RT_HALIGN_LEFT # , RT_HALIGN_RIGHT
from enigma import eConsoleAppContainer
from enigma import eListboxPythonMultiContent, ePoint
from enigma import eServiceReference, eTimer
from enigma import getDesktop, gFont, iPlayableService
from enigma import iServiceInformation, loadPNG # , loadPic
from requests import get
from requests.exceptions import HTTPError
from twisted.internet.reactor import callInThread
# from enigma import addFont
# from twisted.web.client import getPage, downloadPage
# from requests import exceptions
import datetime
import os
import re
from re import search
from re import sub
import sys
import math
# try:
# from urllib import unquote_plus
# except:
# from urllib.parse import unquote_plus
# try:
# from urlparse import parse_qs
# except:
# from urllib.parse import parse_qs
try:
from urllib2 import Request, urlopen
except:
from urllib.request import urlopen, Request
try:
import statvfs
except:
from os import statvfs
def getDesktopSize():
from enigma import getDesktop
s = getDesktop(0).size()
return (s.width(), s.height())
def isFHD():
desktopSize = getDesktopSize()
return desktopSize[0] == 1920
def isDreamOS():
isDreamOS = False
if os.path.exists('/var/lib/dpkg/status'):
isDreamOS = True
return isDreamOS
def convert_size(size_bytes):
if size_bytes == 0:
return "0B"
size_name = ("B", "KB", "MB", "GB", "TB")
i = int(math.floor(math.log(size_bytes, 1024)))
p = math.pow(1024, i)
s = round(size_bytes // p, 2)
return "%s %s" % (s, size_name[i])
def OnclearMem():
try:
os.system('sync')
os.system('echo 1 > /proc/sys/vm/drop_caches')
os.system('echo 2 > /proc/sys/vm/drop_caches')
os.system('echo 3 > /proc/sys/vm/drop_caches')
except:
pass
def threadGetPage(url=None, file=None, key=None, success=None, fail=None, *args, **kwargs):
print('[MovieBrowser][threadGetPage] url, file, key, args, kwargs', url, " ", file, " ", key, " ", args, " ", kwargs)
try:
response = get(url)
response.raise_for_status()
if file is None:
success(response.content)
elif key is not None:
success(response.content, file, key)
else:
success(response.content, file)
except HTTPError as httperror:
print('[MovieBrowser][threadGetPage] Http error: ', httperror)
fail(error) # E0602 undefined name 'error'
except Exception as error:
print('[MovieBrowser][threadGetPage] error: ', error)
if fail is not None:
fail(error)
version = '3.7rc6'
screenwidth = getDesktop(0).size()
dir_plugins = "/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/"
pythonVer = sys.version_info.major
dbmovie = '%sdb/database' % dir_plugins
dbreset = '%sdb/reset' % dir_plugins
dbcache = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/cache'
dbhddcache = '/media/hdd/moviebrowser/cache'
dbusbcache = '/media/usb/moviebrowser/cache'
blacklistmovie = '%sdb/blacklist' % dir_plugins
filtermovie = '%sdb/filter' % dir_plugins
lastfile = '%sdb/last' % dir_plugins
updatelog = '%slog/update.log' % dir_plugins
timerlog = '%slog/timer.log' % dir_plugins
cleanuplog = '%slog/cleanup.log' % dir_plugins
skin_directory = "%sskin/hd/" % (dir_plugins)
if isFHD():
skin_directory = "%sskin/fhd/" % (dir_plugins)
default_backdrop = '%spic/setup/default_backdrop.png' % skin_directory
default_folder = '%spic/browser/default_folder.png' % skin_directory
default_poster = '%spic/browser/default_poster.png' % skin_directory
default_banner = '%spic/browser/default_banner.png' % skin_directory
default_backdropm1v = '%spic/browser/default_backdrop.m1v' % skin_directory
# infoBackPNG = '%spic/browser/info_back.png' % skin_directory
infoBackPNG = '%spic/browser/info_small_back.png' % skin_directory
infosmallBackPNG = '%spic/browser/info_small_back.png' % skin_directory
no_m1v = '%spic/browser/no.m1v' % skin_directory
wiki_png = '%spic/browser/wiki.png' % skin_directory
folders = os.listdir(skin_directory)
if "pic" in folders:
folders.remove("pic")
tmdb_api_key = 'dfc629f7ff6936a269f8c5cdb194c890'
thetvdb_api_key = 'D19315B88B2DE21F'
class ItemList(MenuList):
def __init__(self, items, enableWrapAround=True):
MenuList.__init__(self, items, enableWrapAround, eListboxPythonMultiContent)
if isFHD():
self.l.setItemHeight(50)
self.l.setFont(36, gFont('Regular', 36))
self.l.setFont(32, gFont('Regular', 32))
self.l.setFont(30, gFont('Regular', 30))
else:
self.l.setItemHeight(35)
self.l.setFont(26, gFont('Regular', 26))
self.l.setFont(24, gFont('Regular', 24))
config.plugins.moviebrowser = ConfigSubsection()
lang = language.getLanguage()[:2]
config.plugins.moviebrowser.language = ConfigSelection(default=lang, choices=[
('en', 'English'),
('de', 'German'),
('es', 'Spanish'),
('it', 'Italian'),
('fr', 'French'),
('ru', 'Russian')
])
config.plugins.moviebrowser.filter = ConfigSelection(default=':::Movie:Top:::', choices=[(':::Movie:Top:::', _('Movies')), (':::Series:Top:::', _('Series')), (':Top:::', _('Movies & Series'))])
config.plugins.moviebrowser.sortorder = ConfigSelection(default='date_reverse', choices=[
('date_reverse', _('Movie Creation Date Descending')),
('date', _('Movie Creation Date Ascending')),
('name', _('Movie Title A-Z')),
('name_reverse', _('Movie Title Z-A')),
('rating_reverse', _('Movie Rating 10-0')),
('rating', _('Movie Rating 0-10')),
('year_reverse', _('Movie Release Date Descending')),
('year', _('Movie Release Date Ascending')),
('runtime_reverse', _('Movie Runtime Descending')),
('runtime', _('Movie Runtime Ascending')),
('folder', _('Movie Folder Ascending')),
('folder_reverse', _('Movie Folder Descending'))
])
config.plugins.moviebrowser.backdrops = ConfigSelection(default='auto', choices=[('info', _('Info Button')), ('auto', _('Automatic')), ('hide', _('Hide'))])
config.plugins.moviebrowser.download = ConfigSelection(default='update', choices=[('access', _('On First Access')), ('update', _('On Database Update'))])
config.plugins.moviebrowser.m1v = ConfigOnOff(default=False) # ConfigSelection(default='no', choices=[('no', _('No')), ('yes', _('Yes'))])
if config.plugins.moviebrowser.m1v.value is True:
config.plugins.moviebrowser.showtv = ConfigSelection(default='hide', choices=[('show', _('Show')), ('hide', _('Hide'))])
else:
config.plugins.moviebrowser.showtv = ConfigSelection(default='show', choices=[('show', _('Show')), ('hide', _('Hide'))])
config.plugins.moviebrowser.showswitch = ConfigOnOff(default=False) # ConfigSelection(default='no', choices=[('no', _('No')), ('yes', _('Yes'))])
config.plugins.moviebrowser.showmenu = ConfigOnOff(default=False) # choices=[('no', _('No')), ('yes', _('Yes'))])
config.plugins.moviebrowser.videobutton = ConfigOnOff(default=False) # choices=[('no', _('No')), ('yes', _('Yes'))])
config.plugins.moviebrowser.lastmovie = ConfigSelection(default='yes', choices=[('yes', _('Yes')), ('no', _('No')), ('folder', _('Folder Selection'))])
config.plugins.moviebrowser.lastfilter = ConfigOnOff(default=False) # choices=[('no', _('No')), ('yes', _('Yes'))])
config.plugins.moviebrowser.showfolder = ConfigOnOff(default=False) # choices=[('no', _('No')), ('yes', _('Yes'))])
config.plugins.moviebrowser.skin = ConfigSelection(default='default', choices=folders)
skin_path = "%s%s/" % (skin_directory, config.plugins.moviebrowser.skin.value)
config.plugins.moviebrowser.plotfull = ConfigSelection(default='show', choices=[('hide', _('Info Button')), ('show', _('Automatic'))])
config.plugins.moviebrowser.timerupdate = ConfigEnableDisable(default=False) # ConfigSelection(default='no', choices=[('no', _('No')), ('yes', _('Yes'))])
config.plugins.moviebrowser.timer = ConfigClock(default=6 * 3600)
config.plugins.moviebrowser.hideupdate = ConfigOnOff(default=False) # ConfigSelection(default='yes', choices=[('yes', _('Yes')), ('no', _('No'))])
config.plugins.moviebrowser.reset = ConfigYesNo(default=False) # ConfigSelection(default='no', choices=[('no', _('No')), ('yes', _('Yes'))])
config.plugins.moviebrowser.style = ConfigSelection(default='metrix', choices=[('metrix', 'Metrix'), ('backdrop', 'Backdrop'), ('posterwall', 'Posterwall')])
config.plugins.moviebrowser.seriesstyle = ConfigSelection(default='metrix', choices=[('metrix', 'Metrix'), ('backdrop', 'Backdrop'), ('posterwall', 'Posterwall')])
config.plugins.moviebrowser.api = NoSave(ConfigSelection(['-> Ok']))
config.plugins.moviebrowser.txtapi = ConfigText(default=tmdb_api_key, visible_width=60, fixed_size=False)
config.plugins.moviebrowser.tvdbapi = NoSave(ConfigSelection(['-> Ok']))
config.plugins.moviebrowser.txttvdbapi = ConfigText(default=thetvdb_api_key, visible_width=60, fixed_size=False)
config.plugins.moviebrowser.moviefolder = ConfigDirectory("/media/hdd/movie")
try:
from Components.UsageConfig import defaultMoviePath
downloadpath = defaultMoviePath()
config.plugins.moviebrowser.moviefolder = ConfigDirectory(default=downloadpath)
except:
if os.path.exists("/usr/bin/apt-get"):
config.plugins.moviebrowser.moviefolder = ConfigDirectory(default='/media/hdd/movie/')
config.plugins.moviebrowser.cachefolder = ConfigSelection(default=dbcache, choices=[(dbcache, 'Default'), (dbhddcache, '/media/hdd'), (dbusbcache, '/media/usb')])
config.plugins.moviebrowser.cleanup = ConfigYesNo(default=False) # ConfigSelection(default='no', choices=[('no', 'NO'), ('yes', '<Cleanup>')])
config.plugins.moviebrowser.backup = ConfigYesNo(default=False) # ConfigSelection(default='no', choices=[('no', 'NO'), ('yes', '<Backup>')])
config.plugins.moviebrowser.restore = ConfigYesNo(default=False) # ConfigSelection(default='no', choices=[('no', 'NO'), ('yes', '<Restore>')])
config.plugins.moviebrowser.transparency = ConfigSlider(default=255, limits=(100, 255))
# config.plugins.moviebrowser.autocheck = ConfigSelection(default='yes', choices=[('yes', _('Yes')), ('no', _('No'))])
# config.plugins.moviebrowser.paypal = ConfigSelection(default='yes', choices=[('yes', _('Yes')), ('no', _('No'))])
# config.plugins.moviebrowser.font = ConfigSelection(default='yes', choices=[('yes', _('Yes')), ('no', _('No'))])
# deskWidth = getDesktop(0).size().width()
# if deskWidth >= 1280:
# config.plugins.moviebrowser.plugin_size = ConfigSelection(default='full', choices=[('full', '1280x720'), ('normal', '1024x576')])
# else:
# config.plugins.moviebrowser.plugin_size = ConfigSelection(default='normal', choices=[('full', '1280x720'), ('normal', '1024x576')])
# config.plugins.moviebrowser.fhd = ConfigSelection(default='no', choices=[('yes', _('Yes')), ('no', _('No'))])
# if config.plugins.moviebrowser.fhd.value == 'yes':
# from enigma import eSize, gMainDC
# if config.plugins.moviebrowser.font.value == 'yes':
# try:
# addFont('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/font/Sans.ttf', 'Sans', 100, False)
# except Exception as ex:
# print(ex)
# addFont('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/font/Sans.ttf', 'Sans', 100, False, 0)
# try:
# addFont('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/font/MetrixHD.ttf', 'Metrix', 100, False)
# except Exception as ex:
# print(ex)
# addFont('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/font/MetrixHD.ttf', 'Metrix', 100, False, 0)
# config.plugins.moviebrowser.color = ConfigSelection(default='#007895BC', choices=[
# ('#007895BC', 'Default'),
# ('#00F0A30A', 'Amber'),
# ('#00825A2C', 'Brown'),
# ('#000050EF', 'Cobalt'),
# ('#00911D10', 'Crimson'),
# ('#001BA1E2', 'Cyan'),
# ('#00008A00', 'Emerald'),
# ('#0070AD11', 'Green'),
# ('#006A00FF', 'Indigo'),
# ('#00A4C400', 'Lime'),
# ('#00A61D4D', 'Magenta'),
# ('#0076608A', 'Mauve'),
# ('#006D8764', 'Olive'),
# ('#00C3461B', 'Orange'),
# ('#00F472D0', 'Pink'),
# ('#00E51400', 'Red'),
# ('#007A3B3F', 'Sienna'),
# ('#00647687', 'Steel'),
# ('#00149BAF', 'Teal'),
# ('#004176B6', 'Tufts'),
# ('#006C0AAB', 'Violet'),
# ('#00BF9217', 'Yellow')
# ])
config.plugins.moviebrowser.metrixcolor = ConfigSelection(default='0x00000000', choices=[
('0x00000000', 'Skin Default'),
('0x00F0A30A', 'Amber'),
('0x007895BC', 'Blue'),
('0x00825A2C', 'Brown'),
('0x000050EF', 'Cobalt'),
('0x00911D10', 'Crimson'),
('0x001BA1E2', 'Cyan'),
('0x00008A00', 'Emerald'),
('0x0070AD11', 'Green'),
('0x006A00FF', 'Indigo'),
('0x00BB0048', 'Magenta'),
('0x0076608A', 'Mauve'),
('0x006D8764', 'Olive'),
('0x00C3461B', 'Orange'),
('0x00F472D0', 'Pink'),
('0x00E51400', 'Red'),
('0x007A3B3F', 'Sienna'),
('0x00647687', 'Steel'),
('0x00149BAF', 'Teal'),
('0x004176B6', 'Tufts'),
('0x006C0AAB', 'Violet'),
('0x00BF9217', 'Yellow')
])
def applySkinVars(skin, dict):
for key in dict.keys():
try:
skin = skin.replace('{' + key + '}', dict[key])
except Exception as e:
print(e, '@key=', key)
return skin
def transHTML(text):
text = text.replace(' ', ' ').replace('ß', 'ss').replace('"', '"').replace('–', '-').replace('Ø', '').replace('„', '"').replace('“', '"').replace('’', "'").replace('>', '>').replace('<', '<')
text = text.replace('©.*', ' ').replace('&', '&').replace('ü', '\xc3\x83\xc2\xbc').replace('ä', '\xc3\x83\xc2\xa4').replace('ö', '\xc3\x83\xc2\xb6').replace('é', '\xc3\xa9').replace('…', '...').replace('è', '\xc3\xa8').replace('à', '\xc3\xa0')
text = text.replace('Ü', 'Ue').replace('Ä', 'Ae').replace('Ö', 'Oe').replace('"', '"').replace('"', '"').replace('&', 'und').replace(''', "'").replace(''', "'").replace('…', '...').replace('Ä', '\xc3\x83\xe2\x80\x9e').replace('Ö', '\xc3\x83\xe2\x80\x93').replace('Ü', '\xc3\x83\xc5\x93').replace('ß', '\xc3\x83\xc5\xb8').replace('ä', '\xc3\x83\xc2\xa4').replace('ö', '\xc3\x83\xc2\xb6').replace('ü', '\xc3\x83\xc2\xbc')
return text
def transMOVIE(text):
text = text.lower() + '+FIN'
text = text.replace(' ', '+').replace(' ', '+').replace('&', '+').replace(':', '+').replace('_', '+').replace('.', '+').replace('"', '+').replace('(', '+').replace(')', '+').replace('[', '+').replace(']', '+').replace('!', '+').replace('++++', '+').replace('+++', '+').replace('++', '+')
text = text.replace('+720p+', '++').replace('+1080i+', '+').replace('+1080p+', '++').replace('+dtshd+', '++').replace('+dtsrd+', '++').replace('+dtsd+', '++').replace('+dts+', '++').replace('+dd5+', '++').replace('+5+1+', '++').replace('+3d+', '++').replace('+ac3d+', '++').replace('+ac3+', '++').replace('+avchd+', '++').replace('+avc+', '++').replace('+dubbed+', '++').replace('+subbed+', '++').replace('+stereo+', '++')
text = text.replace('+x264+', '++').replace('+mpeg2+', '++').replace('+avi+', '++').replace('+xvid+', '++').replace('+blu+', '++').replace('+ray+', '++').replace('+bluray+', '++').replace('+3dbd+', '++').replace('+bd+', '++').replace('+bdrip+', '++').replace('+dvdrip+', '++').replace('+rip+', '++').replace('+hdtv+', '++').replace('+hddvd+', '++')
text = text.replace('+german+', '++').replace('+ger+', '++').replace('+english+', '++').replace('+eng+', '++').replace('+spanish+', '++').replace('+spa+', '++').replace('+italian+', '++').replace('+ita+', '++').replace('+russian+', '++').replace('+rus+', '++').replace('+dl+', '++').replace('+dc+', '++').replace('+sbs+', '++').replace('+se+', '++').replace('+ws+', '++').replace('+cee+', '++')
text = text.replace('+remux+', '++').replace('+directors+', '++').replace('+cut+', '++').replace('+uncut+', '++').replace('+extended+', '++').replace('+repack+', '++').replace('+unrated+', '++').replace('+rated+', '++').replace('+retail+', '++').replace('+remastered+', '++').replace('+edition+', '++').replace('+version+', '++')
text = sub('\\+tt[0-9]+\\+', '++', text)
text = sub('\\+\\+\\+\\+.*?FIN', '', text)
text = sub('\\+FIN', '', text)
return text
def transSERIES(text):
text = text.lower() + '+FIN'
text = text.replace(' ', '+').replace(' ', '+').replace('&', '+').replace(':', '+').replace('_', '+').replace('u.s.', 'us').replace('l.a.', 'la').replace('.', '+').replace('"', '+').replace('(', '+').replace(')', '+').replace('[', '+').replace(']', '+').replace('!', '+').replace('++++', '+').replace('+++', '+').replace('++', '+')
text = text.replace('+720p+', '++').replace('+1080i+', '+').replace('+1080p+', '++').replace('+dtshd+', '++').replace('+dtsrd+', '++').replace('+dtsd+', '++').replace('+dts+', '++').replace('+dd5+', '++').replace('+5+1+', '++').replace('+3d+', '++').replace('+ac3d+', '++').replace('+ac3+', '++').replace('+avchd+', '++').replace('+avc+', '++').replace('+dubbed+', '++').replace('+subbed+', '++').replace('+stereo+', '++')
text = text.replace('+x264+', '++').replace('+mpeg2+', '++').replace('+avi+', '++').replace('+xvid+', '++').replace('+blu+', '++').replace('+ray+', '++').replace('+bluray+', '++').replace('+3dbd+', '++').replace('+bd+', '++').replace('+bdrip+', '++').replace('+dvdrip+', '++').replace('+rip+', '++').replace('+hdtv+', '++').replace('+hddvd+', '++')
text = text.replace('+german+', '++').replace('+ger+', '++').replace('+english+', '++').replace('+eng+', '++').replace('+spanish+', '++').replace('+spa+', '++').replace('+italian+', '++').replace('+ita+', '++').replace('+russian+', '++').replace('+rus+', '++').replace('+dl+', '++').replace('+dc+', '++').replace('+sbs+', '++').replace('+se+', '++').replace('+ws+', '++').replace('+cee+', '++')
text = text.replace('+remux+', '++').replace('+directors+', '++').replace('+cut+', '++').replace('+uncut+', '++').replace('+extended+', '++').replace('+repack+', '++').replace('+unrated+', '++').replace('+rated+', '++').replace('+retail+', '++').replace('+remastered+', '++').replace('+edition+', '++').replace('+version+', '++')
text = text.replace('\xc3\x9f', '%C3%9F').replace('\xc3\xa4', '%C3%A4').replace('\xc3\xb6', '%C3%B6').replace('\xc3\xbc', '%C3%BC')
text = sub('\\+tt[0-9]+\\+', '++', text)
text = sub('\\+\\+\\+\\+.*?FIN', '', text)
text = sub('\\+FIN', '', text)
return text
def _renewTMDb(text):
name = sub('.*?[/]', '', text)
if name.endswith('.ts'):
name = sub('_', ' ', name)
name = sub('^.*? - .*? - ', '', name)
name = sub('^[0-9]+ [0-9]+ - ', '', name)
name = sub('^[0-9]+ - ', '', name)
text = sub('[.]ts', '', name)
else:
text = sub('\\.avi|\\.divx|\\.flv|\\.iso|\\.ISO|\\.m2ts|\\.m4v|\\.mov|\\.mp4|\\.mpg|\\.mpeg|\\.mkv|\\.vob', '', name)
return text
def _renewTVDb(text):
name = sub('.*?[/]', '', text)
if name.endswith('.ts'):
name = sub('_', ' ', name)
name = sub('^.*? - .*? - ', '', name)
name = sub('^[0-9]+ [0-9]+ - ', '', name)
name = sub('^[0-9]+ - ', '', name)
text = sub('[.]ts', '', name)
else:
text = sub('\\.avi|\\.divx|\\.flv|\\.iso|\\.ISO|\\.m2ts|\\.m4v|\\.mov|\\.mp4|\\.mpg|\\.mpeg|\\.mkv|\\.vob', '', name)
return text
class movieBrowserMetrix(Screen):
def __init__(self, session, index, content, filter):
skin = os.path.join(skin_path + "movieBrowserMetrix.xml")
with open(skin, "r") as f:
self.skin = f.read()
Screen.__init__(self, session)
self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
self.__event_tracker = ServiceEventTracker(screen=self, eventmap={iPlayableService.evEOF: self.seenEOF})
self.toogleHelp = self.session.instantiateDialog(helpScreen)
self.index = index
self.hideflag = True
self.ready = False
self.startupdate = False
self.reset = False
self.tmdbposter = False
self.topseries = False
self.filterseen = False
self.showhelp = False
self.back = False
self.content = content
self.filter = filter
self.language = '&language=%s' % config.plugins.moviebrowser.language.value
self.showfolder = config.plugins.moviebrowser.showfolder.getValue()
self.ABC = 'ABC'
self.namelist = []
self.movielist = []
self.datelist = []
self.infolist = []
self.plotlist = []
self.posterlist = []
self.backdroplist = []
self.contentlist = []
self.seenlist = []
self.medialist = []
self.dddlist = []
self['name'] = Label()
self['Director'] = Label(_('Director:'))
self['Actors'] = Label(_('Actors:'))
self['Year'] = Label(_('Years:'))
self['Runtime'] = Label(_('Runtime:'))
self['Country'] = Label(_('Country:'))
self['text1'] = Label(_('Update'))
self['text2'] = Label(_('Style'))
self['text3'] = Label(_('Help'))
self['Genres'] = Label(_('Genres:'))
self['director'] = Label()
self['actors'] = Label()
self['year'] = Label()
self['runtime'] = Label()
self['country'] = Label()
self['genres'] = Label()
self['ratings'] = ProgressBar()
self['ratings'].hide()
self['ddd'] = Pixmap()
self['ddd'].hide()
self['ddd2'] = Pixmap()
self['ddd2'].hide()
self['seen'] = Pixmap()
self['seen'].hide()
self['ratingsback'] = Pixmap()
self['ratingsback'].hide()
# self['metrixback'] = Pixmap()
# self['metrixback2'] = Pixmap()
# self['metrixback2'].hide()
self['menu'] = Pixmap()
self['info'] = Pixmap()
self['help'] = Pixmap()
self['pvr'] = Pixmap()
self['text'] = Pixmap()
self['yellow'] = Pixmap()
self['red'] = Pixmap()
self['green'] = Pixmap()
self['backdrop'] = Pixmap()
self.oldbackdropurl = ''
self.backdrops = config.plugins.moviebrowser.backdrops.getValue()
if content == ':::Series:Top:::':
self.episodes = True
else:
self.episodes = False
self.control = False
self.toggleCount = 0
self['plotname'] = Label()
self['plotfull'] = ScrollLabel()
self['plotfull'].hide()
self['poster'] = Pixmap()
self['posterback'] = Pixmap()
self['eposter'] = Pixmap()
self['eposter'].hide()
self['banner'] = Pixmap()
self['banner'].hide()
self['label'] = Label()
self['label2'] = Label()
self['label3'] = Label()
self['list'] = ItemList([])
self['episodes'] = ItemList([])
self['episodes'].hide()
self['seasons'] = MenuList([])
self['seasons'].hide()
self['audiotype'] = MultiPixmap()
self['videomode'] = MultiPixmap()
self['videocodec'] = MultiPixmap()
self['aspectratio'] = MultiPixmap()
self['actions'] = ActionMap([
'OkCancelActions',
'DirectionActions',
'ColorActions',
'ChannelSelectBaseActions',
'HelpActions',
'InfobarActions',
'InfobarTeletextActions',
'MovieSelectionActions',
'MoviePlayerActions',
'InfobarEPGActions',
'NumberActions'
], {
'ok': self.ok,
'cancel': self.exit,
'right': self.rightDown,
'left': self.leftUp,
'down': self.down,
'up': self.up,
'nextBouquet': self.up,
'prevBouquet': self.down,
'nextMarker': self.gotoABC,
'prevMarker': self.gotoXYZ,
'red': self.switchStyle,
'yellow': self.updateDatabase,
'blue': self.hideScreen,
'green': self.showHelp,
'contextMenu': self.config,
'showEventInfo': self.toggleInfo,
'EPGPressed': self.toggleInfo,
'startTeletext': self.editDatabase,
'showMovies': self.updateDatabase,
'showRadio': self.deleteMovie,
'leavePlayer': self.markSeen,
'1': self.controlMovies,
'2': self.renewTMDb,
'3': self.renewTVDb,
'4': self.filterSeen,
'5': self.toogleContent,
'6': self.filterFolder,
'7': self.filterDirector,
'8': self.filterActor,
'9': self.filterGenre,
'0': self.gotoEnd,
'bluelong': self.showHelp,
'displayHelp': self.showHelp
}, -1)
self.movie_stop = config.usage.on_movie_stop.value
self.movie_eof = config.usage.on_movie_eof.value
config.usage.on_movie_stop.value = 'quit'
config.usage.on_movie_eof.value = 'quit'
# self.database = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/database'
# self.blacklist = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/blacklist'
# self.lastfilter = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/filter'
# self.lastfile = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/last'
self.database = dbmovie
self.blacklist = blacklistmovie
self.lastfilter = filtermovie
self.lastfile = lastfile
self.onLayoutFinish.append(self.onLayoutFinished)
def onLayoutFinished(self):
if fileExists(self.database):
size = os.path.getsize(self.database)
if size < 10:
os.remove(self.database)
if config.plugins.moviebrowser.metrixcolor.value == '0x00000000':
self.backcolor = False
else:
self.backcolor = True
self.back_color = int(config.plugins.moviebrowser.metrixcolor.value, 16)
# self.metrixBackPNG = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/skin/fhd/pic/browser/metrix_back.png'
# metrixBack = loadPic(self.metrixBackPNG, 620, 670, 3, 0, 0, 0)
# self.metrixBack2PNG = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/skin/fhd/pic/browser/metrix_back2.png'
# metrixBack2 = loadPic(self.metrixBack2PNG, 570, 640, 3, 0, 0, 0)
# if metrixBack is not None and metrixBack2 is not None:
# self['metrixback'].instance.setPixmap(metrixBack)
# self['metrixback2'].instance.setPixmap(metrixBack2)
# self['metrixback'].show()
# self['metrixback2'].show()
# posterback = '/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/skin/fhd/pic/browser/default_poster.png'
# PosterBack = loadPic(posterback, 245, 245, 3, 0, 0, 0)
# self['posterback'].instance.setPixmap(PosterBack)
self['posterback'].hide()
self['yellow'].hide()
self['red'].hide()
self['green'].hide()
if config.plugins.moviebrowser.showtv.value == 'hide' or config.plugins.moviebrowser.m1v.value is True:
self.session.nav.stopService()
if fileExists(self.database):
if self.index == 0:
if config.plugins.moviebrowser.lastfilter.value is True:
self.filter = open(self.lastfilter).read()
if config.plugins.moviebrowser.lastmovie.value == 'yes':
movie = open(self.lastfile).read()
if movie.endswith('...'):
self.index = -1
else:
movie = sub('\\(|\\)|\\[|\\]|\\+|\\?', '.', movie)
data = open(self.database).read()
count = 0
for line in data.split('\n'):
if self.content in line and self.filter in line:
if search(movie, line) is not None:
self.index = count
break
count += 1
elif config.plugins.moviebrowser.lastmovie.value == 'folder' and self.showfolder is True:
self.index = -1
self.makeMovieBrowserTimer = eTimer()
self.makeMovieBrowserTimer.callback.append(self.makeMovies(self.filter))
self.makeMovieBrowserTimer.start(500, True)
else:
self.openTimer = eTimer()
self.openTimer.callback.append(self.openInfo)
self.openTimer.start(500, True)
return
def openInfo(self):
if fileExists('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/reset'):
self.session.openWithCallback(self.reset_return, MessageBox, 'The Movie Browser Database will be rebuild now. Depending on the number of your Movies this can take several minutes.\n\nIf the plugin terminates after a few minutes, restart the plugin and make a manual Database Update (Video button).\n\nRebuild the Database now?', MessageBox.TYPE_YESNO)
else:
self.session.openWithCallback(self.first_return, MessageBox, _('Before the Database will be rebuild, check your settings in the setup of the plugin:\n\n- Check the path to the Movie Folder\n- Check your TMDb/TheTVDb Language\n- Change the Cache Folder to your hard disk drive.'), MessageBox.TYPE_YESNO)
def first_return(self, answer):
if answer is True:
open('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/reset', 'w').close()
config.usage.on_movie_stop.value = self.movie_stop
config.usage.on_movie_eof.value = self.movie_eof
# self.session.openWithCallback(self.exit, movieBrowserConfig)
self.session.openWithCallback(self.close, movieBrowserConfig)
else:
OnclearMem()
self.close()
def reset_return(self, answer):
if answer is True:
self.reset = True
if fileExists('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/reset'):
os.remove('/usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/db/reset')
if fileExists(self.blacklist):
os.remove(self.blacklist)
open(self.database, 'w').close()
self.makeMovieBrowserTimer = eTimer()
self.resetTimer = eTimer()
self.resetTimer.callback.append(self.database_return(True))
self.resetTimer.start(500, True)
else:
self.close()
def makeMovies(self, filter):
if filter is not None:
self.namelist = []
self.movielist = []
self.datelist = []
self.infolist = []
self.plotlist = []
self.posterlist = []
self.backdroplist = []
self.contentlist = []
self.seenlist = []
self.medialist = []
self.dddlist = []
self.filter = filter
if fileExists(self.database):
f = open(self.database, 'r')
for line in f:
if self.content in line and filter in line:
name = ""
filename = ""
date = ""
runtime = ""
rating = ""
director = ""
actors = ""
genres = ""
year = ""
country = ""
plotfull = ""
poster = str(default_poster)
backdrop = str(default_backdrop)
seen = 'unseen'
content = 'Movie:Top'
media = '\n'
movieline = line.split(':::')
try:
name = movieline[0]
name = sub('[Ss][0]+[Ee]', 'Special ', name)
filename = movieline[1]
date = movieline[2]
runtime = movieline[3]
rating = movieline[4]
director = movieline[5]
actors = movieline[6]
genres = movieline[7]
year = movieline[8]
country = movieline[9]
plotfull = movieline[10]
poster = movieline[11]
backdrop = movieline[12]
content = movieline[13]
seen = movieline[14]
media = movieline[15]
except IndexError:
pass
self.namelist.append(name)
self.movielist.append(filename)
if '3d' in filename.lower():
self.dddlist.append('yes')
else:
self.dddlist.append('no')
self.datelist.append(date)
res = []
res.append(runtime)
res.append(rating)
res.append(director)
res.append(actors)
res.append(genres)
res.append(year)
res.append(country)
self.infolist.append(res)
self.plotlist.append(plotfull)
self.posterlist.append(poster)
self.backdroplist.append(backdrop)
self.contentlist.append(content)
self.seenlist.append(seen)
self.medialist.append(media)
f.close()
if self.showfolder is True:
self.namelist.append(_('<List of Movie Folder>'))
self.movielist.append(config.plugins.moviebrowser.moviefolder.value + '...')
self.datelist.append('')
res = []
res.append('')
res.append('0.0')
res.append('')
res.append('')
res.append('')
res.append('')
res.append('')
self.infolist.append(res)
self.plotlist.append('')
# self.posterlist.append('https://sites.google.com/site/kashmirplugins/home/movie-browser/default_folder.png')
# self.backdroplist.append('https://sites.google.com/site/kashmirplugins/home/movie-browser/default_backdrop.png')
self.posterlist.append(str(default_folder))
self.backdroplist.append(str(default_backdrop))
self.contentlist.append(':Top')
self.seenlist.append('unseen')
self.medialist.append('\n')
self.maxentry = len(self.namelist)
self.makeList()
if self.backdrops != 'hide':
try:
self.showBackdrops(self.index)
except IndexError:
pass
else:
self.showDefaultBackdrop()
self.ready = True
OnclearMem()
return
def makeList(self):
f = open(self.database, 'r')
movies = []
for line in f:
if self.content in line and self.filter in line:
movieline = line.split(':::')
try:
res = ['']
if self.content == ':::Series:::':
movie = sub('.*? - \\(', '', movieline[0])
movie = sub('\\) ', ' ', movie)
movie = sub('S00E00 - ', '', movie)
movie = sub('[Ss][0]+[Ee]', 'Special ', movie)
else:
movie = movieline[0]
if screenwidth.width() == 1920:
if self.backcolor is True:
res.append(MultiContentEntryText(pos=(10, 0), size=(810, 50), font=30, color=16777215, color_sel=16777215, backcolor_sel=self.back_color, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=movie))
else:
res.append(MultiContentEntryText(pos=(10, 0), size=(810, 50), font=30, color=16777215, color_sel=16777215, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=movie))
else:
if self.backcolor is True:
res.append(MultiContentEntryText(pos=(5, 0), size=(540, 40), font=26, color=16777215, color_sel=16777215, backcolor_sel=self.back_color, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=movie))
else:
res.append(MultiContentEntryText(pos=(5, 0), size=(540, 40), font=26, color=16777215, color_sel=16777215, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=movie))
movies.append(res)
except IndexError:
pass
f.close()
if self.content == ':::Series:::':
movies.sort()
if self.showfolder is True:
res = ['']
if screenwidth.width() == 1920:
if self.backcolor is True:
res.append(MultiContentEntryText(pos=(10, 0), size=(810, 50), font=30, color=16777215, color_sel=16777215, backcolor_sel=self.back_color, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_('<List of Movie Folder>')))
else:
res.append(MultiContentEntryText(pos=(10, 0), size=(810, 50), font=30, color=16777215, color_sel=16777215, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_('<List of Movie Folder>')))
else:
if self.backcolor is True:
res.append(MultiContentEntryText(pos=(5, 0), size=(540, 40), font=26, color=16777215, color_sel=16777215, backcolor_sel=self.back_color, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_('<List of Movie Folder>')))
else:
res.append(MultiContentEntryText(pos=(5, 0), size=(540, 40), font=26, color=16777215, color_sel=16777215, flags=RT_HALIGN_LEFT | RT_VALIGN_CENTER, text=_('<List of Movie Folder>')))
movies.append(res)
self['list'].l.setList(movies)
try:
self['list'].moveToIndex(self.index)
except IndexError:
pass
try:
content = self.contentlist[self.index]
if self.toggleCount == 0:
if content == 'Series:Top':
self.hideInfo()
self.makeEpisodes()
if self.back is True:
self.back = False
self['list'].selectionEnabled(0)
self['episodes'].selectionEnabled(1)
self.control = True
else:
self.hideEpisodes()
self.makePoster()
self.makeName(self.index)
self.makeInfo(self.index)
else:
if content != 'Series':
self.makePoster()
self.makeName(self.index)
self.makeInfo(self.index)
else:
self.makeName(self.index)
self.hideInfo()
self.makeEPoster()
plot = self.plotlist[self.index]
self['plotfull'].setText(plot)
self.showPlot()
except IndexError:
pass
self.ready = True
self.totalMovies = len(movies)
self.totalItem = len(movies)
if self.showfolder is True:
self.totalMovies -= 1
free = _('Free Space')
folder = _('Movie Folder')
movies = _('MOVIES')
series = _('SERIES')
episodes = _('EPISODES')
if os.path.exists(config.plugins.moviebrowser.moviefolder.value):
movieFolder = os.statvfs(config.plugins.moviebrowser.moviefolder.value)
try:
stat = movieFolder
freeSize = convert_size(float(stat.f_bfree * stat.f_bsize))
except Exception as e:
print(e)
freeSize = "-?-"
if self.content == ':::Movie:Top:::':
titel = '%s %s' % (str(self.totalMovies), movies)
titel2 = '(%s: %s %s)' % (folder, str(freeSize), free)
elif self.content == ':::Series:Top:::':
titel = '%s %s' % (str(self.totalMovies), series)
titel2 = '(%s: %s %s)' % (folder, str(freeSize), free)
elif self.content == ':::Series:::':
titel = '%s %s' % (str(self.totalMovies), episodes)
titel2 = '(%s: %s %s)' % (folder, str(freeSize), free)
else:
titel = '%s %s & %s' % (str(self.totalMovies), movies, series)
titel2 = '(%s: %s %s)' % (folder, str(freeSize), free)
self['label'].setText(titel)
self['label2'].setText(titel2)
self['label3'].setText('Item %s/%s' % (str(self.index + 1), str(self.totalItem)))
else:
if self.content == ':::Movie:Top:::':
titel = '%s %s' % (str(self.totalMovies), movies)
titel2 = '(%s offline)' % folder
elif self.content == ':::Series:Top:::':
titel = '%s %s' % (str(self.totalMovies), series)
titel2 = '(%s offline)' % folder
elif self.content == ':::Series:::':
titel = '%s %s' % (str(self.totalMovies), episodes)
titel2 = '(%s offline)' % folder
else:
titel = '%s %s & %s' % (str(self.totalMovies), movies, series)
titel2 = '(%s offline)' % folder
self['label'].setText(titel)
self['label2'].setText(titel2)
self['label3'].setText('Item %s/%s' % (str(self.index + 1), str(self.totalItem)))
def updateDatabase(self):
if self.ready is True:
if os.path.exists(config.plugins.moviebrowser.moviefolder.value) and os.path.exists(config.plugins.moviebrowser.cachefolder.value):
self.session.openWithCallback(self.database_return, MessageBox, '\nUpdate Movie Browser Database?', MessageBox.TYPE_YESNO)
elif os.path.exists(config.plugins.moviebrowser.cachefolder.value):
self.session.open(MessageBox, _('\nMovie Folder %s not reachable:\nMovie Browser Database Update canceled.') % str(config.plugins.moviebrowser.moviefolder.value), MessageBox.TYPE_ERROR)
else:
self.session.open(MessageBox, _('\nCache Folder %s not reachable:\nMovie Browser Database Update canceled.') % str(config.plugins.moviebrowser.cachefolder.value), MessageBox.TYPE_ERROR)
def database_return(self, answer):
if answer is True:
self.ready = False
try:
movie = self.movielist[self.index]
f = open(self.lastfile, 'w')
f.write(movie)
f.close()
except IndexError:
pass
if fileExists(self.database):
self.runTimer = eTimer()
self.runTimer.callback.append(self.database_run)
self.runTimer.start(500, True)
OnclearMem()
def database_run(self):
if config.plugins.moviebrowser.hideupdate.value is True:
self.hideScreen()
found, orphaned, moviecount, seriescount = UpdateDatabase(False, '', '', '').showResult(True)
if config.plugins.moviebrowser.hideupdate.value is True and self.hideflag is False:
self.hideScreen()
movie = open(self.lastfile).read()
movie = sub('\\(|\\)|\\[|\\]|\\+|\\?', '.', movie)
data = open(self.database).read()
count = 0
self.index = 0
for line in data.split('\n'):
if self.content in line and self.filter in line:
if search(movie, line) is not None:
self.index = count
break
count += 1
self.topseries = False
self.toggleCount = 0
if self.content == ':::Series:Top:::':
self.episodes = True
else:
self.episodes = False
self.control = False
if self.startupdate is True:
self.startupdate = False
self.makeMovieBrowserTimer.callback.append(self.makeMovies(self.filter))
elif found == 0 and orphaned == 0:
self.session.open(MessageBox, _('\nNo new Movies or Series found:\nYour Database is up to date.'), MessageBox.TYPE_INFO)
self.makeMovies(self.filter)
elif found == 0:
if orphaned == 1:
self.session.open(MessageBox, _('\nNo new Movies or Series found.\n%s orphaned Database Entry deleted.') % str(orphaned), MessageBox.TYPE_INFO)
else:
self.session.open(MessageBox, _('\nNo new Movies or Series found.\n%s orphaned Database Entries deleted.') % str(orphaned), MessageBox.TYPE_INFO)
self.makeMovies(self.filter)
elif orphaned == 0:
if moviecount == 1 and seriescount == 0:
self.session.open(MessageBox, _('\n%s Movie imported into Database.') % str(moviecount), MessageBox.TYPE_INFO)
elif seriescount == 1 and moviecount == 0:
self.session.open(MessageBox, _('\n%s Series imported into Database.') % str(seriescount), MessageBox.TYPE_INFO)
elif seriescount == 0:
self.session.open(MessageBox, _('\n%s Movies imported into Database.') % str(moviecount), MessageBox.TYPE_INFO)
elif moviecount == 0:
self.session.open(MessageBox, _('\n%s Series imported into Database.') % str(seriescount), MessageBox.TYPE_INFO)
else:
self.session.open(MessageBox, _('\n%s Movies and %s Series imported into Database.') % (str(moviecount), str(seriescount)), MessageBox.TYPE_INFO)
self.makeMovies(self.filter)
else:
if moviecount == 1 and seriescount == 0 and orphaned == 1:
self.session.open(MessageBox, _('\n%s Movie imported into Database.\n%s orphaned Database Entry deleted.') % (str(moviecount), str(orphaned)), MessageBox.TYPE_INFO)
elif seriescount == 1 and moviecount == 0 and orphaned == 1:
self.session.open(MessageBox, _('\n%s Series imported into Database.\n%s orphaned Database Entry deleted.') % (str(seriescount), str(orphaned)), MessageBox.TYPE_INFO)
elif moviecount == 1 and seriescount == 0:
self.session.open(MessageBox, _('\n%s Movie imported into Database.\n%s orphaned Database Entries deleted.') % (str(moviecount), str(orphaned)), MessageBox.TYPE_INFO)
elif seriescount == 1 and moviecount == 0:
self.session.open(MessageBox, _('\n%s Series imported into Database.\n%s orphaned Database Entries deleted.') % (str(seriescount), str(orphaned)), MessageBox.TYPE_INFO)
elif orphaned == 1:
if seriescount == 0:
self.session.open(MessageBox, _('\n%s Movies imported into Database.\n%s orphaned Database Entry deleted.') % (str(moviecount), str(orphaned)), MessageBox.TYPE_INFO)
elif moviecount == 0:
self.session.open(MessageBox, _('\n%s Series imported into Database.\n%s orphaned Database Entry deleted.') % (str(seriescount), str(orphaned)), MessageBox.TYPE_INFO)
else:
self.session.open(MessageBox, _('\n%s Movies and %s Series imported into Database.\n%s orphaned Database Entry deleted.') % (str(moviecount), str(seriescount), str(orphaned)), MessageBox.TYPE_INFO)
elif seriescount == 0:
self.session.open(MessageBox, _('\n%s Movies imported into Database.\n%s orphaned Database Entries deleted.') % (str(moviecount), str(orphaned)), MessageBox.TYPE_INFO)
elif moviecount == 0:
self.session.open(MessageBox, _('\n%s Series imported into Database.\n%s orphaned Database Entries deleted.') % (str(seriescount), str(orphaned)), MessageBox.TYPE_INFO)