@@ -511,32 +511,11 @@ func (o *Object) MimeType(ctx context.Context) string {
511511var commandHelp = []fs.CommandHelp {{
512512 Name : "metadata" ,
513513 Short : "Show metadata about the DOI." ,
514- Long : `This command returns the JSON representation of the DOI.
514+ Long : `This command returns a JSON object with some information about the DOI.
515515
516516 rclone backend medatadata doi:
517517
518- It returns a JSON object representing the DOI.
519- ` ,
520- }, {
521- Name : "title" ,
522- Short : "Show the DOI title if available." ,
523- Long : `This command returns the DOI title.
524-
525- rclone backend title doi:
526-
527- It returns a string representing the DOI title.
528- ` ,
529- }, {
530- Name : "provider" ,
531- Short : "Show the DOI provider." ,
532- Long : `This command returns the DOI provider.
533-
534- rclone backend provider doi:
535-
536- This command can be used to update the rclone.conf file for faster operations with the doi backend
537- as auto-detection for the provider can be avoided.
538-
539- It returns a string representing the DOI provider.
518+ It returns a JSON object representing metadata about the DOI.
540519` ,
541520}, {
542521 Name : "set" ,
@@ -573,12 +552,6 @@ func (f *Fs) Command(ctx context.Context, name string, arg []string, opt map[str
573552 switch name {
574553 case "metadata" :
575554 return f .ShowMetadata (ctx )
576- case "title" :
577- return f .ShowTitle (ctx )
578- case "provider" :
579- return string (f .provider ), nil
580- case "info" :
581- return f .ShowInfo (ctx )
582555 case "set" :
583556 newOpt := f .opt
584557 err := configstruct .Set (configmap .Simple (opt ), & newOpt )
@@ -601,54 +574,16 @@ func (f *Fs) Command(ctx context.Context, name string, arg []string, opt map[str
601574 }
602575}
603576
604- // ShowMetadata returns the metadata associated with the DOI
577+ // ShowMetadata returns some metadata about the corresponding DOI
605578func (f * Fs ) ShowMetadata (ctx context.Context ) (metadata interface {}, err error ) {
606- metadataURL := f .endpoint
607- var result any
608- opts := rest.Opts {
609- Method : "GET" ,
610- RootURL : metadataURL .String (),
611- }
612- err = f .pacer .Call (func () (bool , error ) {
613- res , err := f .srv .CallJSON (ctx , & opts , nil , & result )
614- return shouldRetry (ctx , res , err )
615- })
579+ doiURL , err := url .Parse ("https://doi.org/" + f .opt .Doi )
616580 if err != nil {
617581 return nil , err
618582 }
619- return result , nil
620- }
621-
622- // ShowTitle returns the title associated with the DOI
623- func (f * Fs ) ShowTitle (ctx context.Context ) (title string , err error ) {
624- switch f .provider {
625- case Dataverse :
626- metadata , err := f .getMetadataDataverse (ctx )
627- if err != nil {
628- return "" , err
629- }
630- for _ , field := range metadata .Data .LatestVersion .MetadataBlocks .Citation .Fields {
631- if strings .ToLower (field .TypeName ) == "title" {
632- title , ok := field .Value .(string )
633- if ok {
634- return title , nil
635- }
636- }
637- }
638- case Invenio , Zenodo :
639- metadata , err := f .getMetadataInvenio (ctx )
640- if err != nil {
641- return "" , err
642- }
643- return metadata .Metadata .Title , nil
644-
645- }
646- return "<unknown title>" , nil
647- }
648583
649- func (f * Fs ) ShowInfo (ctx context.Context ) (metadata interface {}, err error ) {
650584 info := map [string ]any {}
651585 info ["DOI" ] = f .opt .Doi
586+ info ["URL" ] = doiURL .String ()
652587 info ["metadataURL" ] = f .endpointURL
653588 info ["provider" ] = f .provider
654589 return info , nil
0 commit comments