Fortschrittsbalken zur kurz (LCD4Linux)

  • am besten mal im ihad im Ersteller Thread nachfragen, evtl packt er das mit bei

    oder lasse die Tuner weg und nimm den Fortschrittsbalken und Restzeit dahinter
    Wähle einen Job, den du liebst, und du wirst nie wieder arbeiten müssen.
    Konfuzius

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von pixbox ()

  • So... ich habs

    Quellcode

    1. # Progress Bar
    2. def putProgress((ConfigPos, ConfigSize, ConfigType, ConfigColor, ConfigAlign, ConfigShadowBar, ConfigShadow), draw, im):
    3. global isVideoPlaying
    4. MAX_W,MAX_H = im.size
    5. POSX = 0
    6. if ConfigAlign != "1":
    7. MAX_W = int(MAX_W/2)
    8. if ConfigAlign == "2":
    9. POSX=MAX_W
    10. isVideoPlaying = 0
    11. isData = False
    12. event_run=0
    13. ProgressBar = MAX_W-3
    14. if self.LsreftoString is not None:
    15. # print "L4L",self.LsreftoString
    16. if ConfigType[1:] == "1":
    17. ms = 1.5
    18. elif ConfigType[1:] == "2":
    19. ms = 2
    20. else:
    21. ms = 1
    22. font = ImageFont.truetype(FONT, int(ConfigSize*ms)+8, encoding='unic') #5
    23. if self.Lpath: # Movie
    24. # print "L4L Path",self.Lpath
    25. isVideoPlaying = 1
    26. if self.Llength is not None:
    27. # print "L4L Len",self.Llength
    28. length = self.Llength
    29. position = self.Lposition
    30. # print "L4L Len",length,position
    31. if length and position:
    32. # print "L4L Len ok"
    33. if length[1] > 0:
    34. # print "L4L Len >0"
    35. if ConfigType[0] in ["2","4","6","8","9","A"]:
    36. if ConfigType[0] in ["8","9","A"]:
    37. dur = int(position[1]/90000)
    38. if dur > 3600:
    39. remaining = "%02d:%02d:%02d" % (dur/3600,dur%3600/60,dur%3600%60)
    40. else:
    41. remaining = "%02d:%02d" % (dur/60,dur%60)
    42. else:
    43. rem = int((length[1] - position[1])/90000)
    44. if length[1]/90000 < 600:
    45. remaining = "+%02d:%02d" % (rem/60,rem%60)
    46. else:
    47. remaining = "%+d min" % (rem/60)
    48. w,h = draw.textsize(remaining, font=font)
    49. if ConfigType[0] in ["2","8"]:
    50. ProgressBar -= (w+10)
    51. Minus = 0
    52. MinusProgress = 0
    53. elif ConfigType[0] in ["6","A"]:
    54. Minus = -(ConfigSize-2+(h-ConfigSize)/2)
    55. MinusProgress = (w+10)
    56. else:
    57. Minus = int(h/1.5)+2
    58. MinusProgress = (w+10)
    59. ShadowText(draw,ProgressBar-MinusProgress+15+POSX, ConfigPos+1-Minus-(h-ConfigSize)/2,remaining,font,ConfigColor,ConfigShadow)
    60. elif ConfigType[0] in ["3","5","7"]:
    61. remaining = "%d %%" % int(position[1]*100/length[1])
    62. w,h = draw.textsize(remaining, font=font)
    63. if ConfigType[0] == "3":
    64. ProgressBar -= (w+10)
    65. Minus = 0
    66. MinusProgress = 0
    67. elif ConfigType[0] == "7":
    68. Minus = -(ConfigSize-2+(h-ConfigSize)/2)
    69. MinusProgress = (w+10)
    70. else:
    71. Minus = int(h/1.5)+2
    72. MinusProgress = (w+10)
    73. ShadowText(draw,ProgressBar-MinusProgress+15+POSX, ConfigPos+1-Minus-(h-ConfigSize)/2,remaining,font,ConfigColor,ConfigShadow)
    74. event_run=int(ProgressBar*position[1]/length[1])
    75. isData = True
    76. # if remaining > 0:
    77. # remaining = remaining / 90000
    78. else: # DVB
    79. event_begin, event_end, duration, event_name = self.Levent_begin0, self.Levent_end0, self.Lduration0, self.Levent_name0
    80. # print "L4L DVB",event_begin, event_end, duration, event_name
    81. if event_begin != 0:
    82. # print "L4L DVB Begin",event_begin
    83. now = int(time())
    84. event_run = now - event_begin
    85. if ConfigType[0] in ["2","4","6","8","9","A"]:
    86. dur = int((event_run)/60)
    87. if ConfigType[0] in ["8","9","A"]:
    88. if dur > 3600:
    89. remaining = "%02d:%02d:%02d" % (dur/3600,dur%3600/60,dur%3600%60)
    90. else:
    91. remaining = "%02d:%02d" % (dur/60,dur%60)
    92. else:
    93. remaining = "%+d min" % int((event_end - now)/60)
    94. w,h = draw.textsize(remaining, font=font)
    95. if ConfigType[0] in ["2","8"]:
    96. ProgressBar -= (w+10)
    97. Minus = 0
    98. MinusProgress = 0
    99. elif ConfigType[0] in ["6","A"]:
    100. Minus = -(ConfigSize-2+(h-ConfigSize)/2)
    101. MinusProgress = (w+10)
    102. else:
    103. Minus = int(h/1.5)+2
    104. MinusProgress = (w+10)
    105. ShadowText(draw,ProgressBar-MinusProgress+15+POSX, ConfigPos+1-Minus-(h-ConfigSize)/2,remaining,font,ConfigColor,ConfigShadow)
    106. elif ConfigType[0] in ["3","5","7"]:
    107. remaining = "%d %%" % int(event_run*100/duration)
    108. w,h = draw.textsize(remaining, font=font)
    109. if ConfigType[0] == "3":
    110. ProgressBar -= (w+10)
    111. Minus = 0
    112. MinusProgress = 0
    113. elif ConfigType[0] == "7":
    114. Minus = -(ConfigSize-2+(h-ConfigSize)/2)
    115. MinusProgress = (w+10)
    116. else:
    117. Minus = int(h/1.5)+2
    118. MinusProgress = (w+10)
    119. ShadowText(draw,ProgressBar-MinusProgress+15+POSX, ConfigPos+1-Minus-(h-ConfigSize)/2,remaining,font,ConfigColor,ConfigShadow)
    120. event_run = int(ProgressBar*event_run/duration)
    121. isData = True
    122. # print event_begin, event_end, event.getDuration(), event.getPlayPosition()
    123. if isData == True:
    124. # print "L4L isdata"
    125. if event_run <0:
    126. event_run = 0
    127. if event_run > ProgressBar:
    128. event_run = ProgressBar
    129. draw.rectangle((POSX+0,ConfigPos,POSX+ProgressBar+2,ConfigPos+ConfigSize),outline=ConfigColor)
    130. draw.rectangle((POSX+1,ConfigPos,POSX+event_run+1,ConfigPos+ConfigSize),fill=ConfigColor)
    131. if ConfigShadowBar == True:
    132. if os.path.isfile(os.path.join(Data,"progress.png")):
    133. try:
    134. imW = Image.open(os.path.join(Data,"progress.png"))
    135. imW = imW.resize((event_run,ConfigSize))
    136. im.paste(imW,(POSX+1,ConfigPos),imW)
    137. except:
    138. L4log("Progress Shade Error")
    Alles anzeigen


    Sieht jetzt so aus
    Dateien
    • dpf.png

      (55,85 kB, 17 mal heruntergeladen, zuletzt: )
    • dpf1.png

      (32,66 kB, 16 mal heruntergeladen, zuletzt: )
    • dpf2.png

      (5,2 kB, 14 mal heruntergeladen, zuletzt: )
    • plugin_py.zip

      (87,83 kB, 6 mal heruntergeladen, zuletzt: )

Flag Counter