|
|
|
@ -1,35 +1,8 @@
|
|
|
|
#!/usr/bin/python3
|
|
|
|
#!/usr/bin/python3
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
lark
|
|
|
|
lark
|
|
|
|
Verify and sort game ROM images.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Intended features:
|
|
|
|
|
|
|
|
DAT downloading
|
|
|
|
|
|
|
|
File validation
|
|
|
|
|
|
|
|
File renaming/moving
|
|
|
|
|
|
|
|
Nice Beets-inspired UI.
|
|
|
|
|
|
|
|
Release grouping (maybe, this might require another large external database)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UI notes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Key terms
|
|
|
|
|
|
|
|
- hash Unique identifier for each ROM release.
|
|
|
|
|
|
|
|
- release ROM release, ripped from physical media.
|
|
|
|
|
|
|
|
- dat List of hashes, with associated filenames.
|
|
|
|
|
|
|
|
- platform The original hardware on which the image was intended to run.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Verbs
|
|
|
|
|
|
|
|
- list [hash, dat, platform, image]
|
|
|
|
|
|
|
|
List items in the database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- import [datfile, imagefile]
|
|
|
|
Verify and sort game ROM images.
|
|
|
|
Process and add external items to the database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- add [platform, hash]
|
|
|
|
|
|
|
|
Manually add items to the database.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- remove [hash, dat, platform]
|
|
|
|
|
|
|
|
Delete items from the database.
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
# TODO: Write decent UI
|
|
|
|
# TODO: Write decent UI
|
|
|
|
import hashlib
|
|
|
|
import hashlib
|
|
|
|
@ -166,8 +139,7 @@ elif action_object == 'release-group':
|
|
|
|
elif action_object == 'release':
|
|
|
|
elif action_object == 'release':
|
|
|
|
if action == 'add':
|
|
|
|
if action == 'add':
|
|
|
|
properties = _kwargs_parse(sys.argv[3:])
|
|
|
|
properties = _kwargs_parse(sys.argv[3:])
|
|
|
|
release = metadata.Release(filename=properties['filename'],
|
|
|
|
release = metadata.Release(**properties)
|
|
|
|
sha1sum=properties['sha1sum'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with metadata.get_db_session() as session:
|
|
|
|
with metadata.get_db_session() as session:
|
|
|
|
if properties['release-group']:
|
|
|
|
if properties['release-group']:
|
|
|
|
@ -179,7 +151,7 @@ elif action_object == 'release':
|
|
|
|
if action == 'list':
|
|
|
|
if action == 'list':
|
|
|
|
# TODO: Filter support is exclusively limited to SQLAlchemy's filter.ilike function. Figure
|
|
|
|
# TODO: Filter support is exclusively limited to SQLAlchemy's filter.ilike function. Figure
|
|
|
|
# out a good way to include other filters.
|
|
|
|
# out a good way to include other filters.
|
|
|
|
print('Listing release groups.')
|
|
|
|
print('Listing releases.')
|
|
|
|
filters = _kwargs_parse(sys.argv[3:])
|
|
|
|
filters = _kwargs_parse(sys.argv[3:])
|
|
|
|
with metadata.get_db_session() as session:
|
|
|
|
with metadata.get_db_session() as session:
|
|
|
|
print(metadata.search(session, metadata.Release, **filters))
|
|
|
|
print(metadata.search(session, metadata.Release, **filters))
|
|
|
|
|