INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Exclude string from link in MC  (Read 1989 times)

MarkCoutinho

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 676
Exclude string from link in MC
« on: June 04, 2012, 07:25:18 am »

I use the links in MC a lot. I've got one for Discogs, for example, that searches for the artist in combination with the title.
However: quite a few songs of mine are extended versions. Therefor the search withing for instance Discogs comes up empty.

Which brings me to the following question:
How can I exclude the string I mention here below from my URL?
Right now it's like this: http:////www.discogs.com//search?q=[Artist]+[Name]&btn=&type=all

The string that has to be excluded is:
(Extended version)

Thanks for your help.
Logged
Mark Coutinho
Dutch Top 40 collector of lyrics, sleeves and bios

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: Exclude string from link in MC
« Reply #1 on: June 04, 2012, 09:00:46 am »

Your best bet would be to use a custom field that is calculated from [Name] instead of [Name] and
create an expression that will omit the () and whatever is inside them from the data.
My knowledge is pretty limited when it comes to expressions but I would think there is a way to do it.
Sorry I couldn't be more helpful but hopefully it will point you in the correct direction.
Maybe someone else will chime in on how to do the expression if possible.
Logged
Sean

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: Exclude string from link in MC
« Reply #2 on: June 04, 2012, 09:41:48 am »

A caluclate field NameC
[artist] - replace([name],/(extendended..../))
(havent tried it)
http://wiki.jriver.com/index.php/Media_Center_expression_language#Replace.28....29:_Replace_or_remove_strings_from_a_value.
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: Exclude string from link in MC
« Reply #3 on: June 04, 2012, 12:08:39 pm »

I use this in a calculated field to clean out everything in a song name that ends with (...) or [...]. It works for me (but it is not very nice coding now that we have other possibilities).

Code: [Select]
if(isequal(left([name],1),/(,1),[name],if(isequal(left([name],1),[,1),[name],if(isequal(listcount([name],/(),1,5),clean(ListItem([name],0,/()),if(isequal(listcount([name],[),1,5),clean(ListItem([name],0,[)),[name]))))
MrC suggested some improvements in a hidden thread (replace [Album] with [Name]):

Two variations of your adjust expression:

ifelse(
   regex([album], /#^[([]#/),        [album],
   regex([album], /#^(.*?)[([]#/),  clean([R1]),
   1, [album]
)

ifelse(
   regex([album], /#^[([]#/),                 [album],
   Compare(listcount([album], /(), >, 1),  clean(ListItem([album], 0, /()),
   Compare(listcount([album], [), >, 1),   clean(ListItem([album], 0, [)),
   1,                                                      [album]
)

I have not tried the suggestions out yet (sorry, MrC).

You could see if any of those will work for you when used in searches.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Exclude string from link in MC
« Reply #4 on: June 04, 2012, 01:09:31 pm »

Here's a quick way to handle it:

   http:////www.discogs.com//search?q=[Artist]+regex([Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)&btn=&type=all

This case-insensitively removes the following forms at the end of Name, within either () or [] brackets (or mixed):

  extended
  extended blah
  extended blah blah blah
Logged
The opinions I express represent my own folly.

MarkCoutinho

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 676
Re: Exclude string from link in MC
« Reply #5 on: June 04, 2012, 03:06:30 pm »

Superduper! Thanks to you all for your kind responses.
MrC's is spot on - I use that one now. But I've learned something too from the other examples.
Great, guys!
Logged
Mark Coutinho
Dutch Top 40 collector of lyrics, sleeves and bios

MarkCoutinho

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 676
Re: Exclude string from link in MC
« Reply #6 on: June 05, 2012, 01:17:17 am »

I've changed all my links with help of this, but the YouTube-link won't work because it's a bit different.

I have changed it to this:
http:////www.youtube.com//results?search_query=Hexify("[Artist]" "[Name]", /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)&btn=&type=all)

But then the site comes up with "artist name" "title (extended version)
So: artist name is good (between the " and the ") but the title has got to get rid of (extended version) and the " has to be added at the end of the title.

How should I do that?

Thanks again.
Logged
Mark Coutinho
Dutch Top 40 collector of lyrics, sleeves and bios

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: Exclude string from link in MC
« Reply #7 on: June 05, 2012, 08:02:51 am »

This works for me
http:////www.youtube.com//results?search_query=Hexify("[Artist]") "regex([Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)"&btn=&type=all
Logged
Sean

MarkCoutinho

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 676
Re: Exclude string from link in MC
« Reply #8 on: June 05, 2012, 12:00:15 pm »

Almost! It does work, however not with a title of more than 1 word. Could you adjust it a tiny bit, please?
Logged
Mark Coutinho
Dutch Top 40 collector of lyrics, sleeves and bios

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Exclude string from link in MC
« Reply #9 on: June 05, 2012, 12:09:30 pm »

You can include [Artist] as part of the regex param, and hexify() the result:

http:////www.youtube.com//results?search_query="Hexify(regex([Artist] [Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1))"&btn=&type=all
Logged
The opinions I express represent my own folly.

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: Exclude string from link in MC
« Reply #10 on: June 05, 2012, 12:19:16 pm »

Almost! It does work, however not with a title of more than 1 word. Could you adjust it a tiny bit, please?

That is odd because this is what I searched for after setting up a test file earlier
Artist: +44
Name: When Your Heart Stop Beating (Extended Version)
Youtube search showed "+44" "When Your Heart Stop Beating"

Just setup another and it worked fine also
Artist: 3 Doors Down
Name: It's the Only One You've Got (Extended Version)
Youtube search showed "3 Doors Down" "It's the Only One You've Got"
Logged
Sean

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: Exclude string from link in MC
« Reply #11 on: June 05, 2012, 12:32:53 pm »

You can include [Artist] as part of the regex param, and hexify() the result:

http:////www.youtube.com//results?search_query="Hexify(regex([Artist] [Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1))"&btn=&type=all

The reason I did it the way I did is he had quotes around Artist and Name separately and I don't know how to hexify and have the quotes inside the regex.
Maybe you can enlighten me.
I tried the below but when I used it the (Extended Version) was not removed
http:////www.youtube.com//results?search_query=Hexify(regex("[Artist]" "[Name]", /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1))"&btn=&type=al
Logged
Sean

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Exclude string from link in MC
« Reply #12 on: June 05, 2012, 12:45:56 pm »

Sorry, I gave some junk earlier.  I was busy talking in the background, not paying attention.

See if this works:

http:////www.youtube.com//results?search_query=Hexify(regex("[Artist]" "[Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)")&btn=&type=al

This keeps the same RE.
Logged
The opinions I express represent my own folly.

Scolex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1116
  • Cheers
Re: Exclude string from link in MC
« Reply #13 on: June 05, 2012, 12:51:49 pm »

Thanks that worked I figured I just needed to move the quotes around but wasn't sure exactly where and my original worked although not very pretty since the Name wasn't being hexified.
Logged
Sean

MarkCoutinho

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 676
Re: Exclude string from link in MC
« Reply #14 on: June 05, 2012, 02:34:44 pm »

Yeah! It works for me too! I've got all my links working and I want to share them with those who are interested.

All results involve these parameters:
- artist is between quotes
- name is between quotes
- addition (extended version) is left out of the result

These are my links:

YouTube: http:////www.youtube.com//results?search_query=Hexify(regex("[Artist]" "[Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)")&btn=&type=al
Lyrics: http:////www.google.com//search?q=lyrics Hexify(regex("[Artist]" "[Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)")&btn=&type=al
Discogs: http:////www.discogs.com//search?q=[Artist]+regex([Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)&btn=&type=all
Covers: http:////images.google.com//images?q=Hexify(regex("[Artist]" "[Name], /#^(.+?)(?: [[(]extended\b[^)\]]*[)\]])?$#/, 1)")&btn=&type=al

Thanks to all those who were willing to help me on this one!
Logged
Mark Coutinho
Dutch Top 40 collector of lyrics, sleeves and bios
Pages: [1]   Go Up