@@ -50,37 +50,6 @@ def abort_if_false(ctx, param, value):
5050 if not value :
5151 ctx .abort ()
5252
53- @click .command ()
54- @click .option ("--recid" , "recid" , help = "ID of the video record" , default = None , required = True )
55- @with_appcontext
56- def create_doi (recid ):
57- """Mints the DOI for a video record."""
58- # Get the video object with recid
59- _ , record = record_resolver .resolve (recid )
60- depid = record .depid
61- video_deposit = Video .get_record (depid .object_uuid )
62-
63- try :
64- # Mint the doi and publish
65- edit_record = video_deposit .edit ().mint_doi ().publish ().commit ()
66- # Save changes
67- db .session .commit ()
68-
69- # Index the record again
70- _ , record_video = edit_record .fetch_published ()
71- RecordIndexer ().index (record_video )
72- click .echo (f"DOI minted, and indexed successfully for record '{ recid } '" )
73-
74- # Register the doi to datacite
75- datacite_register (recid , str (record_video .id ))
76-
77- except DataCiteError as dexc :
78- raise ClickException (f"Failed to register DOI on datacite for the video record '{ recid } ': { str (dexc )} " )
79- except Exception as exc :
80- db .session .rollback ()
81- raise ClickException (f"Failed to mint DOI for the video record '{ recid } ': { str (exc )} " )
82-
83-
8453
8554@click .group ()
8655def subformats ():
@@ -262,3 +231,34 @@ def extract_frames(recid, depid):
262231
263232 db .session .commit ()
264233 index_deposit_project (payload ["deposit_id" ])
234+
235+
236+ @videos .command ()
237+ @click .option ("--recid" , "recid" , help = "ID of the video record" , default = None , required = True )
238+ @with_appcontext
239+ def create_doi (recid ):
240+ """Mints the DOI for a video record."""
241+ # Get the video object with recid
242+ _ , record = record_resolver .resolve (recid )
243+ depid = record .depid
244+ video_deposit = Video .get_record (depid .object_uuid )
245+
246+ try :
247+ # Mint the doi and publish
248+ edit_record = video_deposit .edit ().mint_doi ().publish ().commit ()
249+ # Save changes
250+ db .session .commit ()
251+
252+ # Index the record again
253+ _ , record_video = edit_record .fetch_published ()
254+ RecordIndexer ().index (record_video )
255+ click .echo (f"DOI minted, and indexed successfully for record '{ recid } '" )
256+
257+ # Register the doi to datacite
258+ datacite_register (recid , str (record_video .id ))
259+
260+ except DataCiteError as dexc :
261+ raise ClickException (f"Failed to register DOI on datacite for the video record '{ recid } ': { str (dexc )} " )
262+ except Exception as exc :
263+ db .session .rollback ()
264+ raise ClickException (f"Failed to mint DOI for the video record '{ recid } ': { str (exc )} " )
0 commit comments