On Wed, 8 Mar 2023, at 22:28, Clayton Macleod wrote:
> On Wed, Mar 8, 2023 at 5:34 AM Jeremy Nicoll <jn.ml.pyth...@letterboxes.org>
> wrote:


Please stop sending me private copies of your replies.  I can easily read them
on the mail list itself.



>> I also wondered just how often your add/deletes failed?  Are you adding a
>> track at the instant that your app notices that iTunes has just reached
>> the end of one track and started the next, and presumably at that point
>> removed the just-played track from the playlist?

> The old feature I'm trying to emulate was a 25-song ...  So the songs that 
> are being deleted from the playlist haven't been played in quite some time
> by the time it comes to actually delete it, and even with that, I've added a 
> 1-second delay anyway.

ok


>> It also struck me that in the GUI application - even if as a user you
>> may think you can make changes to playlists at any time - the GUI
>> may inhibit user-made changes for a few fractions of a second if IT
>> is about to make a change, but the COM interface might just be 
>> offering you the code that makes the change without the locking 
>> around it.
>>
>> So eg you might need to search the iTunes COM docs (I know there's
>> some ... for any sign of "locks" or "serialisation" or "queuing" or "data
>> integrity" controls to prevent the app and you simultaneously updating
>> a data structure inside iTunes. ...  It's also possible that - say - it 
>> renumbers or completely rebuilds a playlist structure whenever it 
>> changes.  I wondered if, if that's so, your code would get the rebuilt one
>> each time.

> Well, if I'm there watching it as one song is about to end I can see that
> it deletes the song at the top of the list just fine ...

That's interesting; I know I asked a while back if you could watch stuff
changing in the GUI as your script ran, but in between times I read at

  https://www.joshkunz.com/iTunesControl/

that (it says this right at the top)

"Note that calls to the iTunes COM interface will be suspended when a 
 dialog is being displayed in iTunes."

which made me think you wouldn't in fact be able to do that - that your
script would be frozen.


>  and adds a new song to the end of the list just fine, ignoring the fact
> that there are sometimes errors 

I read in one of the snippets of code that you posted that you were
ignoring errors because you couldn't do anything about them, but
I wonder if eg your script should at least be logging them, perhaps
to see if there's a relationship between when adds fail vv when deletes
do?


>  It was my understanding that the song library was doing snagged 

What?  Errored?

> and put into a local dicationary, and that this
> was where I was selecting my songs from.  


> And also that the delete command
> only deletes the song from the current playlist, and only actually deletes
> the song from the filesystem

Nobody - neither you nor I - has suggested anything has been deleted
from the file system.


> What strikes me as odd is how the references work fine as long as I haven't
> made a delete call, but after I make a delete call the references fail all
> over the place.  It isn't just one reference that no longer works.  It
> throws hundreds of random failures from each of the five groups in the
> 1000-test even though only one file has been through the delete call.

No /file/ has been through a delete call, unless you're changing the 
story.  I hope that was just a slip of the keyboard!

-- 
Jeremy Nicoll - my opinions are my own.
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to