Skip to content

Commit 7158fea

Browse files
committed
dateutil TypeError: Parser must be a string or character stream, not list
1 parent eedee6c commit 7158fea

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

library/createdb/av.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def parse_tags(mu: dict, ti: dict) -> dict:
4848
),
4949
"genre": strings.combine(mu.pop("genre", None), ti.pop("genre", None), mu.pop("albumgenre", None)),
5050
"time_created": date_utils.specific_date(
51-
mu.pop("originalyear", None),
52-
mu.pop("TDOR", None),
53-
mu.pop("TORY", None),
54-
mu.pop("date", None),
55-
mu.pop("TDRC", None),
56-
mu.pop("TDRL", None),
57-
ti.pop("year", None),
51+
strings.combine(mu.pop("originalyear", None)),
52+
strings.combine(mu.pop("TDOR", None)),
53+
strings.combine(mu.pop("TORY", None)),
54+
strings.combine(mu.pop("date", None)),
55+
strings.combine(mu.pop("TDRC", None)),
56+
strings.combine(mu.pop("TDRL", None)),
57+
strings.combine(ti.pop("year", None)),
5858
),
5959
"bpm": nums.safe_int(
6060
iterables.safe_unpack(mu.pop("fBPM", None), mu.pop("bpm", None), mu.pop("bpm_start", None))

library/createdb/nicotine_import.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from library import usage
55
from library.mediadb import db_media
6-
from library.utils import arggroups, argparse_utils
6+
from library.utils import arggroups, argparse_utils, nums
77

88

99
def parse_args() -> argparse.Namespace:
@@ -26,7 +26,11 @@ def from_nicotine_file_list_to_records(data):
2626
for entry in data:
2727
path = entry[0].replace("\\", os.sep)
2828
for song in entry[1]:
29-
song_info = {"path": f"{path}/{song[1]}", "size": song[2], "duration": traverse_obj(song, (4, "1"))}
29+
song_info = {
30+
"path": f"{path}/{song[1]}",
31+
"size": song[2],
32+
"duration": nums.safe_int(traverse_obj(song, (4, "1"))),
33+
}
3034
result.append(song_info)
3135

3236
return result

library/mediafiles/process_media.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,5 +441,5 @@ def process_media() -> None:
441441
args.db.conn.execute("DELETE FROM media where path = ?", [m["new_path"]])
442442
args.db.conn.execute(
443443
"UPDATE media SET path = ?, size = ?, duration = ? WHERE path = ?",
444-
[m["new_path"], m["new_size"], m.get("duration"), m["path"]],
444+
[m["new_path"], m["new_size"], nums.safe_int(m.get("duration")), m["path"]],
445445
)

library/playback/torrents_info.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/python3
2-
import argparse, os, shutil
2+
import argparse, getpass, os, shutil
33
from pathlib import Path
44
from statistics import mean
55

@@ -393,7 +393,12 @@ def gen_row(t):
393393
if os.path.exists(t.content_path):
394394
new_path = Path(args.move)
395395
if not new_path.is_absolute():
396-
new_path = Path(path_utils.mountpoint(t.content_path)) / new_path
396+
mountpoint = path_utils.mountpoint(t.content_path)
397+
if mountpoint in ("/home", "/var/home"):
398+
user = getpass.getuser()
399+
mountpoint = f"{mountpoint}/{user}"
400+
401+
new_path = Path(mountpoint) / new_path
397402

398403
if args.tracker_dirnames:
399404
domain = qbt_get_tracker(qbt_client, t)

library/usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,7 @@ def play(action) -> str:
19351935
19361936
Force-start incomplete downloads
19371937
1938-
library torrents --dl --progress=+10%% --force-start
1938+
library torrents --dl --progress=+10% --force-start
19391939
19401940
Stop completed downloads
19411941

library/utils/strings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ def combine(*list_) -> str | None:
214214
list_ = iterables.conform(list_)
215215
if not list_:
216216
return None
217+
if len(list_) == 1:
218+
return str(list_[0])
217219

218220
no_comma = functools.reduce(operator.iadd, (str(s).split(",") for s in list_), [])
219221
no_semicolon = functools.reduce(operator.iadd, (s.split(";") for s in no_comma), [])

0 commit comments

Comments
 (0)