Skip to content

Commit

Permalink
Merge pull request #2 from Taiko2k/master
Browse files Browse the repository at this point in the history
Sync
  • Loading branch information
StrangeSeasOfThought authored Jun 7, 2019
2 parents 6aadd1a + 053c13c commit 7717f8e
Show file tree
Hide file tree
Showing 6 changed files with 419 additions and 283 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@

Changelog-------------------------------------

v4.3.2
v4.4.0

- Added "Composer" field to track box
- Added "Album-Artist", "Composer" and "Comment" to columns mode
- Added per column colours to theme files
- Redesigned config file to be programmatically generated
- Improved "delete embedded image" function to only remove from single file when shift key down
- Improved search to make album-artist and composer fields searchable
- Tweaked main scroll bar backgroud for transparency, restored size in column mode
- Tweaked main scroll bar background for transparency, restored size in column mode
- Tweaked transcode output setting text for better clarity
- Tweaked bottom panel title to always show if window is large
- Moved "prefer using album-artist in artist list panel" setting to config file
- Moved "double digit" setting to config file
- Fixed and enabled mini mode with maximizing
- Fixed a bug that caused FLAC pictures to not be detected on rare occasion
- Fixed artist list sorting with case sensitivity
- Fixed artist list sort by album-artist setting not remembering on restart
- Fixed setting fonts in config file
- Fixed subtle text rendering issue on some settings buttons
- Fixed column drag tag text positioning

v4.3.1

Expand Down
72 changes: 0 additions & 72 deletions config.txt

This file was deleted.

19 changes: 3 additions & 16 deletions t_modules/t_bass.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,22 +1572,9 @@ def stall_sync(handle, channel, data, user):
if command == "encstart":

bass_player.try_init()
port = "8000"
bitrate = "128"

path = pctl.config_directory + "/config.txt"
with open(path, encoding="utf_8") as f:
content = f.read().splitlines()
for p in content:
if len(p) == 0:
continue
if p[0] == " " or p[0] == "#":
continue
if 'broadcast-port=' in p:
if len(p) < 40:
port = p.split('=')[1]
elif 'broadcast-bitrate=' in p:
bitrate = p.split('=')[1]

bitrate = prefs.broadcast_bitrate
port = prefs.broadcast_port

pctl.broadcast_active = True
print("starting encoder")
Expand Down
160 changes: 160 additions & 0 deletions t_modules/t_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Tauon Music Box - Configuration file module

# Copyright © 2015-2018, Taiko2k captain(dot)gxj(at)gmail.com

# This file is part of Tauon Music Box.
#
# Tauon Music Box is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Tauon Music Box is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Tauon Music Box. If not, see <http://www.gnu.org/licenses/>.

# The purpose of this module is to update, parse and write to a configuration file

import os


class Config:

def __init__(self):

self.live = []
self.old = []

def reset(self):
self.live.clear()
self.old.clear()

def add_text(self, text):

self.live.append(['comment', text])

def add_comment(self, text):

self.live.append(['comment', "# " + text])

def br(self):

self.live.append(['comment', ""])

def update_value(self, key, value):

for item in self.live:
if item[0] != "comment":
if item[1] == key:
item[2] = value
break

def load(self, path):

if os.path.isfile(path):
with open(path, encoding="utf_8") as f:
self.old = f.readlines()

def dump(self, path):

# if os.path.exists(path) and not os.access("test.conf", os.W_OK):
# print("ERROR! Config file cannot be written")
# return

with open(path, 'w', encoding="utf_8") as f:

for item in self.live:

if item[0] == 'comment':
f.write(item[1])
f.write(os.linesep)
continue

f.write(item[1])
f.write(" = ")

if item[0] == 'bool':
if item[2] is True:
f.write("true")
else:
f.write("false")

if item[0] == 'string':
f.write('"')
f.write(item[2])
f.write('"')

if item[0] == 'int':
f.write(str(item[2]))

if item[0] == 'float':
f.write(str(item[2]))

if item[3]:
f.write(" # ")
f.write(item[3])

f.write(os.linesep)

f.write(os.linesep)

def sync_add(self, type, key, default_value, comment=""):

got_old = False
old_value = None

for row in self.old:
row = row.split("#", 1)[0]
if "=" in row:
if row.split("=", 1)[0].strip() == key:
old_value = row.split("=", 1)[1].strip()
if old_value:
got_old = True
break

if type == 'bool':
if got_old:
if old_value == 'true':
self.live.append(['bool', key, True, comment])
return True
if old_value == 'false':
self.live.append(['bool', key, False, comment])
return False
self.live.append(['bool', key, default_value, comment])
return default_value

if type == 'string':
if got_old:
old_value = old_value.strip('"')
if old_value:
self.live.append(['string', key, old_value, comment])
return old_value

self.live.append(['string', key, default_value, comment])
return default_value

if type == 'int':
if got_old and old_value.isdigit():
old_value = int(old_value)
self.live.append(['int', key, old_value, comment])
return old_value

self.live.append(['int', key, default_value, comment])
return default_value

if type == 'float':
if got_old:
try:
old_value = float(old_value)
self.live.append(['float', key, old_value, comment])
return old_value
except:
pass
self.live.append(['float', key, default_value, comment])
return default_value


2 changes: 1 addition & 1 deletion t_modules/t_tagscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def read_vorbis(self, f):
# else:
# print("Tag Scanner: Found unhandled FLAC Vorbis comment field: " + a)
# print(b)
# print("\n-------------------------------------------\n")
# print("\n-------------------------------------------\n")

f.seek(block_position * -1, 1)

Expand Down
Loading

0 comments on commit 7717f8e

Please sign in to comment.