Adding Songs (How can this not work?)

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Adding Songs (How can this not work?)

Re: Adding Songs (How can this not work?)

by _imd1b4u_ » Sat Dec 06, 2008 4:16 am

imd1b4u is 100 % correct!

by imd1b4u » Wed Oct 10, 2007 8:43 am

trixmoto wrote:As I've said, the API is known to be previously lacking, hence why the new wiki has been introduced, so it should improve rapidly now.
I did not see you saying anything like that until I already wasted considerable time. What good does it do to provide information too late? It is not your fault or responsibility, of course. It is the fault of MM's developers and whoever did their web pages. If they would have just said their API was beta quality I wouldn't be complaining.

I am not complaining about MM3, after all. I am just staying the hell away from it. They warn me that it is beta quality. I don't want to deal with that, so I simply avoid it and have nothing to complain about. Why couldn't they do the same with the MM2 API? Of course, ideally they would fix it, but even if they didn't, admitting up front that it is rudimentary or beta quality would be much better than what they have done.
trixmoto wrote:And frankly complaining about "Terminate" is a bit childish, who cares if it's a verb, a noun or an adjective. They could use "Cat" instead for all I care! :lol:
Do you write code like that yourself, especially when you know other people will need to understand it? Why confuse people? Why say it is a cat if it's really a dog? Sure, once someone knows that the cat is really a dog they can deal with it, but how long will it take before they figure that out?

If I really thought you had that attitude, trust me, I would stay the hell away from your scripts, especially if I thought I would need to understand them.

Also, as I said (I thought clearly), it wasn't the worst problem. There are much worse ones. It just was an easy one to explain clearly. You said I should be clear, after all. Right?

Perhaps you are being a bit defensive, even though I was not criticizing you (until now). I do not think you should have used the word "childish", however.

Do you not view working with the API as a challenge and a hobby, as I supposed? Can you not accept the fact that most users of MM did not download it hoping to be challenged - rather, they were hoping it would make their lives easier, if anything. Why would such an attitude be necessarily childish? Most users would not want things to be called by the wrong names. Does that make most users childish?

My expectations were different than yours. That does not make them childish.

Just to put things in perspective, I could have written an entire replacement for MM in less time than I have already spent on one script that I'm not even finished with! Granted, it would not be as pretty and would lack features that I don't use anyway, but I already have a movie database application that would have been fairly easy to modify into a song database application. However, the time I spent on the MM script is already wasted, so I am not sure what to do. :-?

by trixmoto » Tue Oct 09, 2007 3:22 am

As I've said, the API is known to be previously lacking, hence why the new wiki has been introduced, so it should improve rapidly now.

And frankly complaining about "Terminate" is a bit childish, who cares if it's a verb, a noun or an adjective. They could use "Cat" instead for all I care! :lol:

by Bex » Mon Oct 08, 2007 2:55 pm

Jesus!

by imd1b4u » Mon Oct 08, 2007 1:10 pm

trixmoto wrote:I don't understand why you're so frustrated
I'm am frustrated because I was mislead into wasting a large amount of my time. Doing that is immoral, IMO. I don't know how I can be any more clear than that!
trixmoto wrote:... the API has never let me down, although sometimes a little trial and error is necessary.
I get the impression that you and Steegy view working with the API as a challenge and a hobby. You may have somewhat the same attitude as a white-hat hacker, who enjoys solving puzzles and figuring out how to make things work. Plus you will hopefully come up with something that others can enjoy. There is nothing wrong with that. Just understand that most users of MM won't have the same attitude. They want MM to help them. That's why they downloaded it and perhaps paid money for it. I wanted MM to help me. Instead, it wasted my time. I am upset.

Understand too that there were different ways of solving my problem that bypassed the MM API. I thought writing the script would be the quickest and easiest way. It turned out very different. Had MM been more upfront about how bad their API is, I wouldn't have made that mistake.

I think it is doing people a disservice if someone is making the API appear better than it is. It should be clear up front that MM scripting is only for those who want the challenge of figuring out a rather poorly designed and implemented API. That way people are not mislead.

Also, keep in mind that it is reasonable for people to assume that the API is as good as the rest of MM, which is pretty high quality, after all. If the rest of MM was as poor as the API, MM certainly wouldn't be as popular as it is now.
trixmoto wrote:If you think it's unclear, try suggesting a revised paragraph.
I have edited the wiki several times already! Check the history. Keep in mind, though, that it is difficult to come up with something better when you can't figure out what it should say in the first place. Don't think I haven't tried!
trixmoto wrote:Yes "Song.UpdateDB" will add a new track but "SongList.UpdateAll" will not add new tracks. You should instead loop through them, like onkel_enno's AddToLibrary script. I hope this is clear.
Well, now that you say it, it is perfectly clear. What is not clear is how I would have known that before you said it, or why it would be that way.
trixmoto wrote:Please calm down, and if you still have any queries then ask them as clearly as possible. We are all willing to help a new scripter! :)
I should not absolutely need to ask questions. What if I had only occasional or slow internet access? If the API was well designed, implemented and documented, I should be able to figure out everything well enough to get things to work at some basic level. (That doesn't mean I couldn't have improved my script by getting advice from others, but it still would have worked well enough to meet my basic needs.) As it was, I asked questions, had to keep checking for an answer, respond occasionally to people who meant to help but told me things I didn't need to be told, and finally, got told what I needed to hear. That was better than nothing, but not as good as having a good API in the first place.

Besides, why should you (trixmoto) or anyone else need to answer questions that should not have to be asked in the first place? That's your choice, of course, but wouldn't it be better if things were more logical to begin with?

In case you don't understand what I think is unacceptable, but which you (and others) seem to have accepted, here are a couple of examples:

1) Some things that can be done with VBScript can't be done with JScript. At a minimum, that means the developers should have been upfront about the fact that they have only partial JScript support. Yes, the users have documented that there is only partial JScript support, but a new coder won't see that before he was convinced that MM really did have full JScript support. Keep in mind that there don't seem to be many - if any - links to the Wiki from MM's web pages.

There is no law that says MM must offer JScript support, but if the developers claim you can use JScript, it should work.

2) There are some properties in the API named "Terminate". "Terminate" is strictly an action verb in the English language. That means it is a violation of good programming practice (and inherently nonsensical) to name anything, other than a method, "Terminate". One of the most basic concepts in computer programming is that objects represent things while methods represent actions, etc., so you use nouns to name objects, action verbs to name methods, etc. If the developers can't even get that much right, what can they do?

It is one thing to ignore good programming practices in code that only the programmer will ever see, but it's another thing to ignore them in the design of an interface and then advertise the interface as something that will make people's lives easier. That is not acceptable, IMO.

I think (but am unsure) that I read somewhere that the programmers are German, but even if they don't speak English very well, that's still no excuse. It would just mean that they must use a dictionary or have someone fluent in English check what names they picked. They should not be confusing other people by using misleading names in the API. (Or at the very least, MM should have been upfront about it, and warned potential scripters that the designers of the API didn't follow good programming practices.)

Of course, I could come up with much more than these two examples. These aren't the most important problems (there are far worse ones), but it should be easy for anyone to comprehend the problems in these cases.

Again, I wouldn't be so upset about this if I didn't feel as if I was mislead. It's important to not over-sell MM scripting or else you are just misleading people. If people are up for a challenge, fine! But it should be made clear that the MM API is not up to the same quality as the rest of MM.

by trixmoto » Mon Oct 08, 2007 4:10 am

I don't understand why you're so frustrated, and the API has never let me down, although sometimes a little trial and error is necessary. The documentation is getting better all the time now that the Wiki is up and running. There's no need to slate Steegy because you misunderstood his help. If you think it's unclear, try suggesting a revised paragraph.

Yes "Song.UpdateDB" will add a new track but "SongList.UpdateAll" will not add new tracks. You should instead loop through them, like onkel_enno's AddToLibrary script. I hope this is clear.

Please calm down, and if you still have any queries then ask them as clearly as possible. We are all willing to help a new scripter! :)

by imd1b4u » Sun Oct 07, 2007 5:45 pm

Steegy wrote:You probably can't just add an empty SongData object to the library, because that doesn't have an album, artist, ... which it might need to be added successfully.
This adds a song:

Code: Select all

Option Explicit
Dim objSL,objSong
Sub MyTest()
  Set objSL = SDB.NewSongList
  Set objSong = SDB.NewSongData
  objSong.UpdateDB()
  objSL.Add(SDB.NewSongData)
'  objSL.UpdateAll
End Sub
It adds a "blank" song to the songs table as expected. Note: "objSL.UpdateAll" is commented out. That doesn't work. I just left the objSL stuff in there to show the second way that doesn't work.
Steegy wrote:Bottomline: If nobody knows, the only way to find out is to test it ourselves. Certainly with the introduction of the MM3 era. If we still don't get the good grasp, we can ask the developers to shed some light on the subject.
That may be a reasonable attitude for for MM3 since it is still in beta, but it's unacceptable that MM2's interface and documentation are so shoddy, IMO. I have wasted many hours based on the promise that MM2 had a scripting API! It's pathetic. If I had known how bad it was, I never would have tried writing the script in the first place, and would have been much better off. I would have either done the editing manually, or bypassed their API entirely. (I still might do that.)

If MM can't provide a decent API, they should at least own up to that fact. That way they are not misleading anyone.

I am not complaining that I did not get my money's worth out of MM's basic features. It's just that they wasted my time by misleading me into thinking they had decent scriptability that turns out to be very shoddy. If they are going to do offer scripting, they should at least do it right (or warn people that it's 'use at your own risk'). Since time is money, they cost me many times more than I paid for the product! That was a bad deal!

by imd1b4u » Sun Oct 07, 2007 4:46 pm

Steegy wrote: UpdateAll on the SongList object would be better.
Sorry, I am frustrated right now and am taking it out on you.

BTW, IMO, UpdateAll shouldn't be able to add anything to the database. Updating is not adding. The concepts should be kept separate. Either ISDBApplication::NewSongData should add a "blank" song in the database from the very beginning, or there should be a SDB.AddSong(objMyNewSong) and perhaps SDB.AddSongs(objNewSongsList) that would add songs to the database. Anything else should only update (or delete) what is already there.

by Steegy » Sun Oct 07, 2007 4:27 pm

Other part:

You probably can't just add an empty SongData object to the library, because that doesn't have an album, artist, ... which it might need to be added successfully.



Bottomline: If nobody knows, the only way to find out is to test it ourselves. Certainly with the introduction of the MM3 era. If we still don't get the good grasp, we can ask the developers to shed some light on the subject.

by Steegy » Sun Oct 07, 2007 4:24 pm

UpdateAll would be the best way to do it, giving the fact that it does work 100% fine (which it doesn't, and this was found out later than my posting probably).

UpdateAll should be faster because you update a set of songs, instead of each song separately. It also uses the choice of the user in the settings, on how he wants to save stuff: in the tags, in the database, or both.
However, it might give some problems, like trying to "update" SongList objects that contain songs (SongData objects) that aren't in the library (yet), e.g. files browsed to with the My Computer node. There is at least one post about this problem (if only the forum search worked a bit good) but I'm 100% sure of it because I needed it made it as workaround in WST (Web Sources Tagger).

So it depends on your own opinion. Saving the songs themselves explicitly (using UpdateAlbum, UpdateArtist, UpdateDB, SaveTags or so) gives you "full control", but ideally (which it is not yet) UpdateAll on the SongList object would be better.

So maybe I've been wrong about this in past posts, but that was because we (at least I) didn't know any better...

by imd1b4u » Sun Oct 07, 2007 4:19 pm

HA! Guess what! Steegy's script doesn't work either! Apparently, Steegy didn't have a clue what he was talking about in this case, yet he writes a paragraph of incorrect information in the wiki and in a stickied post that's just going to confuse people. Plus he posts a script as an example of how to do something, but his script is WRONG! And he never fixes it!

Granted he said he wasn't finished with the UI of his script (yes, that needed work) but the part that he said was "nice information for you" doesn't work either!

@Steegy, please don't say something works that you've never managed to get to work yourself, unless someone else has.

Actually, what I think would work, and I will try now, is close to what Steegy said, except you must add a call to ISDBSongData::UpdateDB to actually add the new song to the database. Later when you call ISDBSongList::UpdateAll, then perhaps it would update the embedded tags according to the user's preferences.

Damn, I wish I knew that a couple of days ago!

Now I will go and make my third edit to Steegy's Tips and Trick's wiki page.

by imd1b4u » Sun Oct 07, 2007 1:37 pm

Thanks, but that uses the way Steegy recommends against. I'm trying to see if the way he recommends (using UpdateAll) really works.

If need be, I might do it the other way, but I'm hoping I don't need to do that.
In the Tips & Tricks wiki page, Steegy wrote:Using the SongData object, you can either update the database/library (UpdateDB) and/or update the file's tags (WriteTags). So there's no way to let the song changes be saved like the user selected in the Options panel (menu Tools > Options > Library > Tags & Playlists > "Update tags when editing properties"). However, the UpdateAll method for the SongList object does take into account this user-specified option. So you can create a new SongList object using SDB.NewSongList and add your SDBSongData object(s) to it. Then call the UpdateAll method on the songlist, and your song(s) will be saved in user-specified way.

by Bex » Sun Oct 07, 2007 1:04 pm

by imd1b4u » Sun Oct 07, 2007 1:00 pm

ZvezdanD wrote:Add method is for adding existing tracks from a database to some list. After modifying data in this list, you could update same tracks in database with UpdateAll.
Does this really work? Or is it just supposed to work? I can't make it work.

If not, I may use the SQL method. But that wouldn't automatically get the tags embedded in the MP3 files I don't think. The UpdateAll is suppsed to do that.

by ZvezdanD » Sun Oct 07, 2007 12:45 pm

Add method is for adding existing tracks from a database to some list. After modifying data in this list, you could update same tracks in database with UpdateAll.

If you want to add tracks to a database, you could use SDB.Database object and its ExecSQL method.

Top