瀏覽代碼

phschoen: add volume override per artist

Thomas B 2 月之前
父節點
當前提交
bce005f09b
共有 1 個檔案被更改,包括 14 行新增1 行删除
  1. 14
    1
      osci-pi.py

+ 14
- 1
osci-pi.py 查看文件

@@ -57,14 +57,26 @@ bat = None
57 57
 songlist = None
58 58
 currentfile = None
59 59
 lasttime = None
60
+currvol = basevol
61
+
62
+vol_list = [
63
+    ("Harley_Matthews", "100"),
64
+]
65
+
60 66
 
61 67
 basedir = sys.argv[1]
62 68
 if basedir.endswith("/"):
63 69
     basedir = basedir.removesuffix("/")
64 70
 
65 71
 def get_artist(fn):
72
+    global currvol
66 73
     parts = fn.replace(basedir + "/", "").split(os.sep)
67 74
     artist = parts[0].replace("_", " ")
75
+    currvol = basevol
76
+    for i in vol_list:
77
+        if i[0] in fn:
78
+            currvol = i[1]
79
+            break
68 80
     return artist
69 81
 
70 82
 #originalsongs = os.listdir(basedir)
@@ -159,7 +171,8 @@ def play(filename):
159 171
     currentfile = filename
160 172
     status(currentfile)
161 173
 
162
-    currentplaying = subprocess.Popen(["ffplay", "-hide_banner", "-nostats", "-nodisp", "-autoexit", "-volume", basevol, filename])
174
+    print("volume %s " %  currvol)
175
+    currentplaying = subprocess.Popen(["ffplay", "-hide_banner", "-nostats", "-nodisp", "-autoexit", "-volume", currvol, filename])
163 176
 
164 177
 def running():
165 178
     global currentplaying

Loading…
取消
儲存