Browse Source

phschoen: add volume override per artist

Thomas B 3 months ago
parent
commit
bce005f09b
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      osci-pi.py

+ 14
- 1
osci-pi.py View File

57
 songlist = None
57
 songlist = None
58
 currentfile = None
58
 currentfile = None
59
 lasttime = None
59
 lasttime = None
60
+currvol = basevol
61
+
62
+vol_list = [
63
+    ("Harley_Matthews", "100"),
64
+]
65
+
60
 
66
 
61
 basedir = sys.argv[1]
67
 basedir = sys.argv[1]
62
 if basedir.endswith("/"):
68
 if basedir.endswith("/"):
63
     basedir = basedir.removesuffix("/")
69
     basedir = basedir.removesuffix("/")
64
 
70
 
65
 def get_artist(fn):
71
 def get_artist(fn):
72
+    global currvol
66
     parts = fn.replace(basedir + "/", "").split(os.sep)
73
     parts = fn.replace(basedir + "/", "").split(os.sep)
67
     artist = parts[0].replace("_", " ")
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
     return artist
80
     return artist
69
 
81
 
70
 #originalsongs = os.listdir(basedir)
82
 #originalsongs = os.listdir(basedir)
159
     currentfile = filename
171
     currentfile = filename
160
     status(currentfile)
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
 def running():
177
 def running():
165
     global currentplaying
178
     global currentplaying

Loading…
Cancel
Save