1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 19:40:00 +00:00

Update upload api V2 + script for is_trusted

This commit is contained in:
TheAMM 2017-05-21 12:27:34 +03:00
parent 31d8d9ec5b
commit 5408f3e7c4
2 changed files with 9 additions and 1 deletions

View file

@ -130,7 +130,8 @@ UPLOAD_API_FORM_KEYMAP = {
'is_anonymous': 'anonymous', 'is_anonymous': 'anonymous',
'is_hidden': 'hidden', 'is_hidden': 'hidden',
'is_complete': 'complete', 'is_complete': 'complete',
'is_remake': 'remake' 'is_remake': 'remake',
'is_trusted': 'trusted'
} }
UPLOAD_API_FORM_KEYMAP_REVERSE = {v: k for k, v in UPLOAD_API_FORM_KEYMAP.items()} UPLOAD_API_FORM_KEYMAP_REVERSE = {v: k for k, v in UPLOAD_API_FORM_KEYMAP.items()}
UPLOAD_API_KEYS = [ UPLOAD_API_KEYS = [
@ -140,6 +141,7 @@ UPLOAD_API_KEYS = [
'hidden', 'hidden',
'complete', 'complete',
'remake', 'remake',
'trusted',
'information', 'information',
'description' 'description'
] ]

View file

@ -87,6 +87,11 @@ tor_group.add_argument('-H', '--hidden', default=False, action='store_true', hel
tor_group.add_argument('-C', '--complete', default=False, action='store_true', help='Mark torrent as complete (eg. season batch)') tor_group.add_argument('-C', '--complete', default=False, action='store_true', help='Mark torrent as complete (eg. season batch)')
tor_group.add_argument('-R', '--remake', default=False, action='store_true', help='Mark torrent as remake (derivative work from another release)') tor_group.add_argument('-R', '--remake', default=False, action='store_true', help='Mark torrent as remake (derivative work from another release)')
trusted_group = tor_group.add_mutually_exclusive_group(required=False)
trusted_group.add_argument('-T', '--trusted', dest='trusted', action='store_true', help='Mark torrent as trusted, if possible. Defaults to true')
trusted_group.add_argument('--no-trusted', dest='trusted', action='store_false', help='Do not mark torrent as trusted')
parser.set_defaults(trusted=True)
tor_group.add_argument('torrent', metavar='TORRENT_FILE', help='The .torrent file to upload') tor_group.add_argument('torrent', metavar='TORRENT_FILE', help='The .torrent file to upload')
@ -145,6 +150,7 @@ if __name__ == "__main__":
'hidden' : args.hidden, 'hidden' : args.hidden,
'complete' : args.complete, 'complete' : args.complete,
'remake' : args.remake, 'remake' : args.remake,
'trusted' : args.trusted,
} }
encoded_data = { encoded_data = {
'torrent_data' : json.dumps(data) 'torrent_data' : json.dumps(data)