if its too loud, turn it down

Saturday, January 17, 2015

Stop iTunes v12 from Expiring Podcasts

If you're a heavy podcast listener you've probably seen this iTunes message:

 "iTunes has stopped updating this podcast because you have not listened to any episodes recently. Would you like to resume updating this podcast?"

 iTunes stops downloading podcasts if you haven't listened to any of the last 5 downloaded episodes. I perhaps because bandwidth gets expensive? But it's annoying because sometimes you're traveling and not able to sync, or you occasionally listen to the podcast on Stitcher or some other podcatcher right on your phone. Doesn't mean you want them to stop downloading.

 This script http://dougscripts.com/itunes/scripts/ss.php?sp=updateexpiredpodcasts used to work, but somewhere in iTunes version 11 they wised up to it and it stopped working. Now they are actually checking the downloaded tracks to see if any are played.

 So, I wrote a little script that gives 'em what they want. It plays the first unplayed episode in each subscribed podcast, and then back-tracks to the beginning of the podcast so that when you go to listen you don't know the difference. In order for a track to be identified as "played" it appears it needs to have been playing for at least 15 seconds. While the script is running it sets the volume to 0. But it will return the volume to what it was previously set at when it's done. So you can run this via launchd or cron once a day, in the middle of the night.

 Yes, it's kludgey. I can't even say for sure that it works, as I just wrote it. I borrowed some of Doug's code, so credits to him.

UPDATE: This actually appears to work.  I've been running it as a cron job late at night for a couple weeks and haven't had the "expired podcast" issue.  Only weirdness I'm seeing is that the iTunes "messages" (little note that pops up to tell you when a new track is playing) sticks on the last track processed.

-

--check if itunes is running.  if not, activate it
set itunesOK to my itunes_is_running()
if itunesOK is false then
 tell application "iTunes"
  activate
 end tell
end if

tell application "iTunes"
 with timeout of 300 seconds
  
  --see if there's a currently playing track so we can return to it when done
  set playTrack to false
  if player state is playing then
   set aTrack to current track
   stop
   set playTrack to true
   set myMessage to "Running the StopExpired script, will return to your track shortly"
   set myReturn to my growlMessage(myMessage)
  end if
  
  --see what the volume is currently set at
  set curVol to (get sound volume)
  
  --turn the volume all the way down so what we're about to do is not audible
  set sound volume to 0
  
  set podcast_playlist to some playlist whose special kind is Podcasts
  
  -- filter multiple names
  set each_podcast to {}
  try
   set each_podcast to my ASCII_Sort(my get_discrete_list_of(get album of every track of podcast_playlist))
  end try
  
  --display the list (debugging only)
  --set selectedVoice to {choose from list each_podcast}
  
  -- loop thru each podcast
  if each_podcast is not {} then
   repeat with this_podcast in each_podcast
    
    --create a list of unplayed episodes of within each podcast
    set each_unplayed to {}
    try
     set each_unplayed to (every track of podcast_playlist whose album is this_podcast and unplayed is true)
    end try
    
    if each_unplayed is not {} then
     set this_unplayed to (item 1 of each_unplayed)
     
     --for debugging
     set myMessage to this_podcast & ": " & name of this_unplayed as string
     set myReturn to my growlMessage(myMessage)
     
     --download the episode, if it's not already
     
     try
      set url_track to (get URL track of this_unplayed)
      set myMessage to "DOWNLOADING " & name of this_unplayed & " URL: " & URL track as string
      set myReturn to my growlMessage(myMessage)
      download url_track
     end try
     
     
     try
      play this_unplayed
      delay 20
      set player position to 0
      stop this_unplayed
      --back track this_unplayed
      
     end try
     
     --why is this necessary? I don't know.  Sometimes the last track just keeps playing.
     stop
     
    end if
    
   end repeat
  end if
  
  --update all the podcasts
  updateAllPodcasts
  
  --return the sound volume to previous level
  set sound volume to curVol
  
  set myMessage to "StopExpired script complete"
  set myReturn to my growlMessage(myMessage)
  
  --if there was a track already playing, return to it
  if playTrack is true then
   play aTrack
   set playTrack to true
  end if
 end timeout
end tell

--if itunes was originally closed, then close it again
if itunesOK is false then
 tell application "iTunes"
  quit
 end tell
end if

to get_discrete_list_of(list1)
 script a
  property list1ref : list1
 end script
 set list2 to {}
 script b
  property list2ref : list2
 end script
 repeat with i from 1 to length of list1
  set this_item to item i of a's list1ref
  considering case
   if this_item is not "" and this_item is not in b's list2ref then set end of list2 to this_item
  end considering
 end repeat
 return b's list2ref
end get_discrete_list_of

on ASCII_Sort(my_list)
 set the index_list to {}
 set the sorted_list to {}
 repeat (the number of items in my_list) times
  set the low_item to ""
  repeat with i from 1 to (number of items in my_list)
   if i is not in the index_list then
    set this_item to item i of my_list as text
    if the low_item is "" then
     set the low_item to this_item
     set the low_item_index to i
    else if this_item comes before the low_item then
     set the low_item to this_item
     set the low_item_index to i
    end if
   end if
  end repeat
  set the end of sorted_list to the low_item
  set the end of the index_list to the low_item_index
 end repeat
 return the sorted_list
end ASCII_Sort

--subroutine showing messages in growl (preferably)
--and if no growl, default dialog with timeout
to growlMessage(myMessage)
 --show our output message
 -- Check if Growl is running:
 set isRunning to my growl_is_running()
 
 --Only display growl notifications if Growl is running:
 if isRunning = true then
  
  tell application "GrowlHelperApp"
   -- Make a list of all notification types:
   set the allNotificationsList to ¬
    {"Notification 1", "Notification 2"}
   
   -- Make a list of the default enabled notifications:
   set the enabledNotificationsList to ¬
    {"Notification 1"}
   
   -- Register the script with Growl
   -- using either "icon of application"
   -- or "icon of file":
   register as application ¬
    "StopExpired" all notifications allNotificationsList ¬
    default notifications enabledNotificationsList ¬
    icon of application "Script Editor"
   
   -- Send a notification:
   notify with name "Notification 1" title "StopExpired output" description myMessage application name "StopExpired"
  end tell
 else
  display dialog myMessage giving up after 1
 end if
end growlMessage

--sub checks if growl is running
on growl_is_running()
 tell application "System Events" to return (exists process "GrowlHelperApp")
end growl_is_running

--subroutine checks if itunes is running
on itunes_is_running()
 tell application "System Events" to return (exists process "iTunes")
end itunes_is_running

Sunday, June 29, 2014

Tuesday, April 2, 2013

Please avoid Progressive Insurance



As it turns out, Flo isn't quite as fun & friendly as she seems...

http://www.outsidethebeltway.com/progressive-insurance-defends-killer-rather-than-pay-insureds-claim/

It's hard to believe an insurance company can be such an incredible jerk, until it happens to you.

I received a letter from Progressive stating that my homeowner's policy has been cancelled because "the roof is lifting and/or buckling" on my home. I have just purchased the home and had it inspected. The roof is older, but the inspector said I will get 5-7 more years out of it. There is no leaking. There is most definitely not "lifting and/or buckling".

The date the cancellation was in effect is 3/19. I understand that they mailed the letter Jan 24, but because I do not live in the home yet, I did not receive the letter until Mar 2. That leaves me only 2 weeks. Also, I had elected to receive all online communication from Progressive, which they failed to send.

I called Progressive and said that I can do the roof repairs, but given they are weather dependent and I hadn't even had a chance to get quotes, and begged for more time. They refused, saying this is "policy". Even if I had gotten the letter as scheduled, 45 days is not alot of time to find a contractor and cough up thousands of dollars for roof repairs.  Especially when re-roofing requires relatively good weather and I live in the Pacific Northwest.

There seems to be no recourse with them. I can't appeal to them that the roof is actually not in bad shape, their inspector is employed by them and they will not accept opinions of any other inspectors. 45 days is way too short a timeframe to make repairs.

UPDATE: I did go ahead and get a new roof.  But I also took all 6 policies I had with Progressive and went elsewhere.  As it turns out, I am getting better coverage at a lower cost.

There simply is no reason to do business with a company that doesn't care about you, and it more expensive.

Wednesday, March 13, 2013

Petition for Amendment of a State Administrative Rule - WDFW Rule Change #65 (Cabezon)

I went ahead and sent in the petition "PETITION FOR ADOPTION, AMENDMENT, OR REPEAL OF A STATE ADMINISTRATIVE RULE" with the cover letter below.

Even though the Commission is reconsidering rule change #65, it needs to be on record that they did not follow procedure.  

---

March 14, 2013

Washington Dept. of Fish & Wildlife
ATTN: Loreva Preuss
P.O. Box 43144
Olympia, WA 98504-3144

Dear Loreva Preuss,

I have attached a completed Petition for Amendment of a State Administrative Rule.  The rule in question is rule change #65 - "Cabezon minimum size requirement".  The attached petition asks that the Commission amend the adopted rule, removing the catch limit and season restriction that were added after the public comment/testimony period was over.

The CR-102 WAC language and the WDFW web site page requesting public comment mention only a size restriction of 18" on Cabezon (attached relevant pages).  This is what was presented for the public comment period and the February 8, 2013 public testimony in Olympia, which I attended.  For unknown reasons, the rule language was amended considerably to include a catch limit reduction a season restriction, after public comment and public testimony were completed. These additional restrictions appeared in the Concise Explanatory Statement, dated February 22, 2013 (attached relevant pages).  The CES shows that options 2-4 were not included in the CR-102 language.   The March 5, 2013 WDFW press release (attached) shows that the commissioners chose to adopt three of the four restrictions, again, only one of which was presented to the public (the 18" size restriction).

This is a violation of the The Administrative Procedure Act.  RCW 34.05.340 specifically addresses this, "Variance between proposed and final rule" (attached).  

Additionally, I believe a WDFW and possibly even the State of Washington should examine exactly why procedure was not followed in this instance.  While sportfishing restrictions are obviously warranted in certain circumstances, proper procedure must be followed.  The Commission should be held accountable for acting outside of established policy.

Awaiting your reply,


Rory O'Connor

References:
     WDFW Public Comment for Rule Change #65 - http://wdfw.wa.gov/fishing/regulations/rule_proposals/comments/proposal.php?id=143 
     CR-102 WAC - http://wdfw.wa.gov/about/regulations/2013/wsr_13-02-094.pdf
     CES - http://wdfw.wa.gov/fishing/regulations/rule_proposals/comments/2012-2013CESSummaryofPublicCommentStaffRecommendation_02222013.pdf
     March 5 WDFW Press Release - http://wdfw.wa.gov/news/mar0513a/

Tuesday, March 12, 2013

Unimaginable, but CenturyLink is actually worse than Comcast!

Please, I am begging you...never, ever, ever do business with CenturyLink. From the day I signed up two months ago I have not yet had a successful, error-free interaction with their site. I call, and their phone agents tell me I need to call someone else or "our site is having problems today, please try again tomorrow".  Another person actually told me, "our site does not work with Chrome." I can't even log in and pay my bill. And I thought Comcast was bad.