![]() |
#1 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,971
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Converting URL identifiers to custom ones
As mentioned in this post, I got stumped on a search-and-replace and corresponding regexes. I sort of know how to replace the identifier type, but I'm not sure how to proceed with this:
I made two identifiers, ao3 and ffnet, for the respective fanfiction sites. Attachment 181789 For both of them, the {id} is a series of numbers. The number of digits can vary. Here's what I'd like to do: url:https://archiveofourown.org/works/00000000 => ao3:00000000 url:https://www.fanfiction.net/s/0000000/1/ => ffnet:0000000 I think I managed (after a lot of trial-and-error) to make a regex that matches the entire URL, but couldn't figure out how to match just the numbers or replace the identifier type. If at all possible, I'd prefer this to apply only if the #fanficstatus column is not set to "In-Progress." But if this is not possible I think FanFicFare can put the urls back when I check for updates. Is what I'm trying to do here even possible? ![]() Last edited by ownedbycats; 09-06-2020 at 02:28 AM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
The searches should be:
Code:
https://archiveofourown.org/works/(\d+) https://www.fanfiction.net/s/(\d+)/1/ Code:
\1 The above will add the identifier. If you want to remove the URL identifier, you should do the search again, but with nothing in the replace field, and "url" in the destination identifier. To limit it to just the stories that are not "In-Progress", search for the books before doing the search-and-replace. That should be with: Code:
not #fanficstatus:"In-Progress" |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,971
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
That worked. Thank you.
![]() |
![]() |
![]() |
![]() |
#4 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,971
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Another question:
I notice that when I paste a Goodreads or Amazon url into the identifier field with the button it automatically turns it into the right identifier. Is there a way to do this with custom identifiers or do you need a plugin for that? |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
It should just work. In fact, that's why I coded it in the first place. If it doesn't work, it usually means the URL in the clipboard doesn't match the rule you have created.
Are you using the rules above? If so, can you post an actual example for me to test? |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,971
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
It's working now. I can't figure out why it wouldn't work before. Maybe I accidentally messed up the URL.
Last edited by ownedbycats; 09-08-2020 at 11:26 PM. |
![]() |
![]() |
![]() |
#7 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,971
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Is there a way to prevent this from accidentally creating ffnet:https://archiveofourown.org/works/00000000 identifiers (and vice-versa)? I ran both search and replaces on an assortment of fics downloaded from both sites and now I've got a bit of a mess to clean up.
![]() |
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Or was this the result of the search-and-replace? The function I described only happens when you press the identifier paste button. After that, the identifier is changeable by whatever other methods exist and it is up them or you, to make sure they are valid. Or have I misunderstood what the problem is? |
|
![]() |
![]() |
![]() |
#9 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,971
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I was using the bulk search and replace. I had a mix of assorted fics so instead of doing them in two batches I thought I'd be clever and just run both rules on them in one batch. Thus the result I posted there.
|
![]() |
![]() |
![]() |
#10 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
In that case you will need to fix it the same way. Other than setting them from scratch, I can't think of another way.
|
![]() |
![]() |
![]() |
#11 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,971
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Next time I'll just remember to do it in two batches.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Identifiers | Rellwood | Calibre | 2 | 10-31-2019 10:51 PM |
Pasting identifiers | davidfor | Development | 4 | 10-28-2018 08:04 AM |
Consolidate identifiers | Geremia | Library Management | 2 | 03-23-2018 08:39 PM |
Arbitrary Identifiers | BetterRed | Calibre | 2 | 05-08-2016 12:31 AM |
Print friendly url unrelated to regular url (and javascript) | sleepless | Recipes | 3 | 12-03-2011 10:43 AM |