דף 1 מתוך 1

פייתון עזרה

נשלח: 04/01/2017 18:24
על ידי nironiro
ערב טוב לכולם

יש לי את הקוד הזה

קוד: בחירת הכל

import xbmc
import xbmcgui
import time


def executeSomething():
    #code here
    xbmc.executebuiltin("RunScript(special://profile/check.py)")
    time.sleep(5)
while True:
    executeSomething()
הקוד הזה נמצא בתוך service בקודי זה בעצם סרביס שכל 5 שניות בודק לי איזה משהו

ויש את הקוד הזה

קוד: בחירת הכל

import xbmc
import xbmcgui
import time




def kodiidle():
    ILT = 0
    IDLE_TIME_MIN = 1
    s = 0
    while(1):
      it = xbmc.getGlobalIdleTime()
      s = ((IDLE_TIME_MIN * 60) - it )
      if (s > 0): 
        if (ILT == 1):
          if xbmc.Player().isPlayingVideo():
            pass
          else:
            xbmc.executebuiltin("Notification(the light is ,1,2000,special://profile/icon_power_off.png)")
            ILT = 0
        
      elif &#40;s < 0&#41;&#58; 
        if &#40;ILT == 0&#41;&#58;
          xbmc.executebuiltin&#40;"Notification&#40;the light is ,2,2000,special&#58;//profile/icon_power_off.png&#41;"&#41;
          ILT = 1
while True&#58;
    kodiidle&#40;&#41; 
הקוד הזה בודק אם לא נעשה שימוש בקודי דקה
עכשיו מה שאני רוצה זה לשלב בין שתי הקודים

כלומר אם לא נעשה שימוש בקודי דקה הקוד הראשון יפסיק לעבוד
וכאשר אני חוזר לשימוש בקודי הקוד הראשון יחזור לעבודה כל 5 שניות

שיחקתי קצת בקוד ולא ממש הצלחתי
יש כאן מספר חברים שעזרו לי בעבר בכמה דברים ואני מקווה שאתם תעזרו לי שוב

תודה והמשך ערב דבש
[/code]