SQL-Viewer 2.4 [Script] 2009-10-25

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Onweerwolf
Posts: 705
Joined: Tue Dec 12, 2006 5:32 pm
Location: The Netherlands

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by Onweerwolf »

I hope i'm not too annoying as a n00b asking this most likely very simple question: what query do i use to get the artist and title of a specific songid?
Image
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by nynaevelan »

SELECT Artist, SongTitle FROM Songs WHERE ID = 'replace ID here'
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
GhOsT_MZ
Posts: 6
Joined: Sat Feb 28, 2009 1:35 pm
Location: Rostov-on-Don

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by GhOsT_MZ »

I want change a song path. Initially root of path is ":\_Music\Andrey\", I want change this to ":\_MM_MEDIA\". I execute next query:

Code: Select all

UPDATE Songs SET SongPath = REPLACE(SongPath, '@_Music\Andrey', '@_MM@_MEDIA');
Query executed without errors, but field SongPath not changed. Why? How I can change this field?

PS: sorry for my english...
I do not speak English, so forgive me for my english
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by Bex »

This should do it, but please back up your database first!

Code: Select all

UPDATE Songs SET SongPath = REPLACE(SongPath, ':\_Music\Andrey\', ':\_MM_MEDIA\')
WHERE SongPath like ':\_Music\Andrey\%';
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
GhOsT_MZ
Posts: 6
Joined: Sat Feb 28, 2009 1:35 pm
Location: Rostov-on-Don

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by GhOsT_MZ »

Bex wrote:This should do it, but please back up your database first!

Code: Select all

UPDATE Songs SET SongPath = REPLACE(SongPath, ':\_Music\Andrey\', ':\_MM_MEDIA\')
WHERE SongPath like ':\_Music\Andrey\%';
Thanks, it's working)
I do not speak English, so forgive me for my english
timelezz
Posts: 151
Joined: Sun Nov 27, 2005 6:08 am

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by timelezz »

Is it safe to use SQL Viewer 2.4 with MM4?
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by nynaevelan »

I've used it with mm4 but I have not tested it with any of the new fields that are in mm4.
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
timelezz
Posts: 151
Joined: Sun Nov 27, 2005 6:08 am

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by timelezz »

Can someone help me out? I also need to change the folder name. But the folders are on a different PC, within the same network group.

It was: \\Algemeen\d\mp3\
must be: \\Algemeen\mp3\

Can you please make the query for me? I'm totally not experienced and am afraid I will screw it all up.
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by Bex »

If I understand you correctly this should do it, but please back up your database first!

Code: Select all

UPDATE Songs SET SongPath = REPLACE(SongPath, '\\Algemeen\d\mp3\', '\\Algemeen\mp3\')
WHERE SongPath like '\\Algemeen\d\mp3\%';
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
timelezz
Posts: 151
Joined: Sun Nov 27, 2005 6:08 am

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by timelezz »

Hmmm... did not do the job jet. I went to the folder in MM. Selected all those entries. Then started the Script SQL viewer. Entered the code in the big box in the middle and hit RUN Select Query. It took about 7 seconds and 0 rows.

I'm totally new to SQL viewer. Maybe I do sth wrong?
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by Bex »

SQL can only change the path in MM's database. But I guess that's what you want to do?

1. What is the incorrect path in your database?
2. What do you want to update it to in MM's database?
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
bonjo
Posts: 32
Joined: Mon Jan 01, 2007 11:44 am

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by bonjo »

Hi. I have a quite similar problem, but I can't get it SQL-Viewer to do the work:
I changed the volume character (from H: to N:) on an external drive containing my music and also the path to the music folder:
old: H:\jaBU\iMusic\
new: N:\2 Music\
Then I opened MM and found all my music, under the new drive letter, but within the old path: N:\jaBU\iMusic\
All songs are displayed black, but when trying to play, they turn grey and don't play.
I am completely new to SQL-Viewer and have no coding experience whatsoever. I entered the following into the window:

Code: Select all

UPDATE Songs SET SongPath = REPLACE(SongPath, '\\jaBU\iMusic\', '\\2 Music\')
WHERE SongPath like '\\jaBU\iMusic\%';
Then I hit 'Run Select Query' (although I am not sure what the buttons mean): 0.234 sec, nothing happens (except #____ in the bottom window).
Then I hit 'Execute DDL/DML Statement': Information window 'Statement Successfully Executed in 0,344 sec'
Nothing has changed with the songs.
Please help :-?
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by Bex »

Actually, changing the drive letter would still make the songs playable since MM uses the driveID of a drive to locate it. The reason it doesn't work now is that you have changed the folder. To make it work again, do like this:

1. Back up your database!

2. Run this statement: (Use either button.)

Code: Select all

UPDATE Songs SET SongPath = REPLACE(SongPath, ':\jaBU\iMusic\', ':\2 Music\')
WHERE SongPath like ':\jaBU\iMusic\%';
3. Let me know it it worked.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
bonjo
Posts: 32
Joined: Mon Jan 01, 2007 11:44 am

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by bonjo »

Hey, thanks, it worked. Took quite some time, but with 12500 songs, no wonder.
Don't forget to restart MM!

What's the difference between \\xyz\ and :\xyz\
I would have thought that the \\xyz searches anywhere in the path, whereas :\xyz searches only including the leading colon from right after the drive letter?
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: SQL-Viewer 2.4 [Script] 2009-10-25

Post by Bex »

Great, how long time did it take? (It should be pretty fast.)
What's the difference between \\xyz\ and :\xyz\
The driveletter is not stored in the path field in the database. I.e all paths starts with :\xyz\. If you use UNC path then do the paths start with \\xyz\ (\\DEVICENAME\folder).
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Post Reply