1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 Converting Media Tags from vb3

Discussion in 'Installation, Upgrade, and Import Support' started by Kintaro, Dec 20, 2011.

  1. Kintaro

    Kintaro Well-Known Member

    In vb3 I use AME Automatic Media Embeding.

    The problem is that AME have the possibility to restore link removing [AME] tags but it will restore it with [url] tags... plus some tags are like [AME=youtube]9MkB6NkQscI[/AME] and it will restore it like

    [url]9MkB6NkQscI[/url]


    do you suggest to maintain AME tags and replace them in a second moment?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You can try doing a simple SQL query to replace identical strings in the post table.

    Code:
    UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');
    So in your case it would be:
    Code:
    UPDATE xf_post SET message = REPLACE(message,'[AME=youtube]','[media=youtube]');
    UPDATE xf_post SET message = REPLACE(message,'[/AME]','[/media]');
    Take a backup of the post table first though before you try that.
     
  3. Kintaro

    Kintaro Well-Known Member

    oh ok, I was editing asking the "replace thing" :D

    thank you
     
  4. Kintaro

    Kintaro Well-Known Member

    Here I am again :D

    I was wrong with the tags, they are not simple like [ame=youtube] :(

    I played a little with regex into mysql replace query for extract and replace from vb3_post.pagetext something like this:

    Code:
    [ame="http://www.youtube.com/watch?v=rH9w5M1afc&feature=g-all-u&context=G240730aFAAAAAAAADAA"]title      - YouTube[/ame]
    into this:

    Code:
    http://www.youtube.com/watch?v=rH9w5M1afc
    But I fail! :D
    I need to study more regex!!
    Can you help me with this?

    p.s. In this way when I'll import in xenforo it will embed right?
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    For a replacement like that you can use this addon:

    http://xenforo.com/community/threads/post-content-find-replace.6548/

    Here are settings for your replacement. I tested this using the example in your post:

    Quick Find: [ame

    Regular expression: #\[ame="http:.+youtube.+v=(\w+)(&.+)?"\].+\[/ame\]#siU

    Replacement String: [media=youtube]\1[/media]

    Screen shot 2011-12-22 at 6.04.44 PM.png
     
    Coop1979 likes this.
  6. Kintaro

    Kintaro Well-Known Member

    Wow I totally missed it! ...and is a Kier addon!
    I need to work on my search skill. :D

    p.s. Thank you for the regex Jake.
     
  7. Rob

    Rob Well-Known Member

    how would i match these:-
    [ url = "http://www.youtube.com/blah"]link text [/ url] and turn them into regular media tags?

    Either that, or I need to re-enable AME and convert those tags instead. I need to do this also for amazon links and god knows what else.

    I'm thinking it should be easier to work with regular [u rl] tags do you think?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Try this:

    Quick Find: [url

    Regular expression: #\[url="http:.+youtube.+v=(\w+)(&.+)?"\].+\[/url\]#siU

    Replacement String: [media=youtube]\1[/media]
     
    Coop1979 likes this.
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This should do it:

    Quick Find: [ame

    Regular expression: #\[ame\]http:.+youtube\.com/(\w+)\[/ame\]#siU

    Replacement String: [media=youtube]\1[/media]
     
    Coop1979 likes this.
  10. JABRONI

    JABRONI Well-Known Member

    hmm, it didn't find anything when i searched but im in a thread its on right now lol

    [​IMG]
     
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Quick Find: [ame

    Regular expression: #\[ame\]http:.+youtube\.com/watch\?v=(\w+)(&.+)?\[/ame\]#siU

    Replacement String: [media=youtube]\1[/media]
     
    JulianD and Coop1979 like this.
  12. JABRONI

    JABRONI Well-Known Member

    I know im being a nuisance but now i get this error lol

    [​IMG]
     
  13. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Home -> Options -> Messages -> Maximum Media Embeds per Message
     
  14. JABRONI

    JABRONI Well-Known Member

    thank you so much, it really means a lot
     
  15. hathway

    hathway Member

    I tried the regex to replace the ame ones, and it found a bunch, but afterwards I'm still seeing the [ame tags and no videos in the posts.
     
  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Make sure you checked Save Changes, otherwise it will list the matching posts but not make any changes:

    Screen shot 2012-05-17 at 3.50.00 PM.png
     
  17. hathway

    hathway Member

    I modified the regex slightly and was able to find the rest:

    #\[ame="?http:.+youtube.+v=(\w+)(&.+)?"?\].+\[/ame\]#siU
     
    MsJacquiiC and Coop1979 like this.
  18. JulianD

    JulianD Well-Known Member

    I'm sorry to bring this thread up after so many months but I have recently imported my 5M forum and I'm having some trouble converting all these AME links.

    I can't get to match this one with the expressions above.

    Code:
    [ame]http://www.youtube.com/watch?v=mJb_I0y-Da8[/ame]
    [ame="http://www.youtube.com/watch?v=KbWgUO-Rqcw"]http://www.youtube.com/watch?v=KbWgUO-Rqcw[/ame]
    [ame="http://www.youtube.com/watch?v=-3X00EPzphA"]http://www.youtube.com/watch?v=-3X00EPzphA[/ame]
    [ame]http://www.youtube.com/watch?v=QfOmCmc-syc[/ame]
    
    [ame]http://www.youtube.com/watch?v=WUE7nGPfaa4#[/ame]
    [ame]http://www.youtube.com/watch?v=gPjkUXXH5V4#[/ame]
    Any help would be appreciated @hathway @Jake Bunce =)
     
  19. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    @JulianD

    Quick Find: [ame

    Regular expression: #\[ame(=".+")?\]http://www\.youtube\.com/watch\?v=([a-zA-Z0-9_\-]+?).*\[/ame\]#siU

    Replacement String: [media=youtube]\2[/media]
     
    WoodiE and JulianD like this.
  20. JulianD

    JulianD Well-Known Member

    Thank you very much Jake! It worked!
     

Share This Page