Showing posts with label Grateful Dead. Show all posts
Showing posts with label Grateful Dead. Show all posts

Friday, 31 December 2010

Count-GDDuplicate.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     Finds duplicates in the GD archive – A script
  4.     for New Year’s eve! 
  5. .DESCRIPTION 
  6.  
  7. .NOTES 
  8.     File Name  : Count-GDDuplicate.ps1 
  9.     Author     : Thomas Lee - tfl@psp.co.uk 
  10.     Requires   : PowerShell V2 
  11. .LINK 
  12.     http://pshscripts.blogspot.com/2010/12/count-gdduplicateps1.html 
  13. .EXAMPLE 
  14.     Psh[Cookham8]>C:\foo\Count-GdDuplicate.ps1 
  15.     Count-GDDuplicate.ps1 - v 1.0.1 
  16.  
  17.     99 shows have duplicates 
  18.     109 shows are duplicates of others 
  19. #> 
  20.  
  21. ### 
  22. # Start of Script 
  23. ## 
  24.  
  25. # Constants: 
  26. # $GDDiskRoot    - where to find shows 
  27. # $DeadShowBase  - folder at top of gd shows 
  28.  
  29. $GDDiskRoot = "M:" 
  30. $DeadShowBase = $GDDiskRoot + "\gd" 
  31.  
  32. # Announce Ourselves 
  33. "DuplicateCount.ps1 - v 0.0.1" 
  34. "+---------------------------------+" 
  35. "! Find Duplicate Shows :  $DeadShowBase   !" 
  36. "+---------------------------------+" 
  37. "" 
  38. # Get start time 
  39. $starttime = Get-Date 
  40. set-strictmode -off 
  41.  
  42. # Get the Dead shows 
  43.  
  44. $Dir = ls $DeadShowBase | where {$_.psiscontainer} 
  45. $DeadShows = $Dir.count 
  46. if ($DeadSHows -le 0) {"no shows found - check constants"; return
  47.  
  48. # So here look for duplicates. 
  49.  
  50. $shows =@{} 
  51.  
  52. $j = 0 
  53. foreach ($show in $dir){ 
  54. $j++ 
  55. $showdate = $show.name.substring(0,10) 
  56. if ($shows.$showdate) { 
  57.   $shows.$showdate++ 
  58. }   
  59. else
  60.   $shows += @{$showdate=1} 
  61. }    
  62.  
  63.  
  64. $shows = $shows.getenumerator() | Sort name 
  65. $totaldups = 0 
  66. $totaldupshows = 0 
  67. foreach ($show in $shows){ 
  68.    if ($show.value -gt 1) { 
  69.      # "{1} copies of: {0}" -f  $show.name, $show.value 
  70.      $totaldups++    
  71.      $totaldupshows += $show.value - 1 # anything after the 1st is a dup 
  72.    } 
  73.  
  74. # Display Summary 
  75. "{0} shows have duplicates" -f $totaldups 
  76. "{0} shows are duplicates of others" -f $totaldupshows 
Technorati Tags:

Monday, 2 February 2009

Updates on A Grateful Dead PowerShell Script

I really love mixing two of my favourite things: the good old Grateful Deal and PowerShell. I’ve posted a couple of scripts that examine my live show archive. Yesterday, I was able to spend some time updating my Count-GDSHows script. In Count-GDShows2.ps1, I added a couple of features. First I worked out how many shows are recording using the SHN format and how many in FLAC (plus how many are not noted in the folder name). Second, I timed the script, although the timing varies widely thanks to disk caching!

My GD (and my Jerry Garcia) archive is stored on a couple of external USB disks. I have separated Jerry shows from GD shows and have both stored on disks plugged into separate machines. I use the folder name of each show to define the date, type (aud vs sbd) and encoding format. So a show in “gd69-04-22.sbd.clugston.68.sbeok.shnf” is a soundboard encoded in the Shorten format, for a show on April 22 1969. Were you even alive then?

I wonder how many of this blog’s readers collect Grateful Dead shows? I have a standing offer that I’ll repeat: If you want the shows in my collection, send me a big disk and I’ll xcopy!

Technorati Tags: ,

Sunday, 1 February 2009

Count-GDShows2.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     Counts the Grateful Dead shows in my archives and displays 
  4.     details of the collection. 
  5. .DESCRIPTION 
  6.     This script looks at my GD archive, and uses folder names to 
  7.     determine show type (aud, sbd, etc), and checks to see what 
  8.     shows have checked MD5s. The script also times itself. 
  9.      
  10.     This is an update to an earlier script that adds separate  
  11.     counts for FLAC and SHN shows. 
  12. .NOTES 
  13.     File Name  : Count-GDShows2.ps1 
  14.     Author     : Thomas Lee - tfl@psp.co.uk 
  15.     Requires   : PowerShell V2 CTP3 
  16. .LINK 
  17.     http://pshscripts.blogspot.com/2009/02/count-gdshows2ps1.html
  18. .EXAMPLE 
  19.     PS C:\foo> Count-GDShows2.ps1 
  20.     Count.ps1 - v 2.0.2 
  21.     +---------------------------+ 
  22.     ! Dead Show Base  :  M:\gd  ! 
  23.     +---------------------------+ 
  24.  
  25.     Grateful Dead Show Summary 
  26.     -------------------------- 
  27.     Total shows:   1146 
  28.     Soundboards:   800 
  29.     Auds       :   70 
  30.     Unknown    :   29 
  31.     Partial    :   9 
  32.     SHN        :   962 
  33.     FLAC       :   137 
  34.     No coding  :   47 
  35.     Broken     :   4 
  36.     MD5's check:   489 (42.67 %) 
  37.     It took 0 minutes, 1 seconds 
  38.      
  39. #> 
  40. ### 
  41. # Start of Archive 
  42. ## 
  43.  
  44. # Constants: 
  45. # $GDDiskRoot      - where to find shows 
  46. # $DeadShowBase  - folder at top of gd shows 
  47.  
  48. $GDDiskRoot = "M:" 
  49. $DeadShowBase   = $GDDiskRoot + "\gd" 
  50.  
  51. # Announce Ourselves 
  52. "Count.ps1 - v 2.0.2" 
  53. "+---------------------------+" 
  54. "! Dead Show Base  :  $DeadShowBase  !" 
  55. "+---------------------------+" 
  56. "" 
  57. # Get start time 
  58. $starttime = Get-Date 
  59.  
  60. # Count the Dead shows 
  61.  
  62. $Dir= ls $DeadShowBase  | where {$_.psiscontainer} 
  63. $DeadShows=$Dir.count 
  64. if ($DeadSHows -le 0) {"no shows found - check constants"} 
  65.  
  66. #Create subsets based on names of the folders 
  67. $deadsbds   = $dir | where {$_.name -match ".sbd" } 
  68. $deadbrkn   = $dir | where {$_.name -match "broken" } 
  69. $deadpart   = $dir | where {$_.name -match "partial" } 
  70. $deadauds   = $dir | where {$_.name -match ".aud" } 
  71. $deadunkw   = $dir | where {$_.name -match ".unk"} 
  72. # workout recording type 
  73. $deadshn    = $dir | where {$_.name -match ".shn"} 
  74. $deadflac   = $dir | where {$_.name -match ".flac"} 
  75. $deadnocoding = $dir | where {$_.name -notmatch ".shn" -and $_.name -notmatch ".flac"} 
  76.  
  77. #and see how many have the md5ok's file? 
  78. $DeadMD5Checked=0 
  79. foreach ($d in $dir) 
  80. {  
  81.   $sn=$d.fullname + "\md5check_ok" 
  82.   $md5ok= ls $sn -ea silentlycontinue 
  83.   if ($md5ok )  
  84.      {$DeadMD5Checked++} 
  85.  
  86. # Get finishtime and calc elapsed 
  87. $finishtime=Get-Date 
  88. $executiontime = $finishtime - $starttime 
  89. $min = $executiontime.minutes 
  90. $sec = $executiontime.seconds 
  91.  
  92. #Display results 
  93.  
  94. "Grateful Dead Show Summary" 
  95. "--------------------------" 
  96. "Total shows:   $deadshows" 
  97. "Soundboards:   $($deadsbds.count)" 
  98. "Auds       :   $($deadauds.count)" 
  99. "Unknown    :   $($deadunkw.count)" 
  100. "Partial    :   $($deadpart.count)" 
  101. "SHN        :   $($deadshn.count)" 
  102. "FLAC       :   $($deadflac.count)" 
  103. "No coding  :   $($deadnocoding.count)" 
  104. "Broken     :   $($deadbrkn.count)" 
  105. $DeadPctChecked=($DeadMD5checked/$DeadShows).tostring("P"
  106. "MD5's check:   $DeadMD5checked ($DeadPctChecked)" 
  107. "It took {0} minutes, {1} second(s)" -f $min,$sec 
  108. "" 

Saturday, 31 January 2009

Count-GDShows.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     Counts the Grateful Dead shows in my archives 
  4. .DESCRIPTION 
  5.     This script looks at my GD archive, and uses folder names to 
  6.     determine show type (aud, sbd, etc), and checks to see what 
  7.     shows have checked MD5s 
  8. .NOTES 
  9.     File Name  : count-gdshows.ps1 
  10.     Author     : Thomas Lee - tfl@psp.co.uk 
  11.     Requires   : PowerShell V2 CTP3 
  12. .LINK 
  13.     http://pshscripts.blogspot.com/2009/01/count-gdshowsps1.html 
  14. .EXAMPLE 
  15.     PS C:\foo> count-gdshows.ps1 
  16.     Count.ps1 - v 2.0.1 
  17.     +---------------------------+ 
  18.     ! Dead Show Base  :  M:\gd  ! 
  19.     +---------------------------+ 
  20.  
  21.     Grateful Dead Show Summary 
  22.     -------------------------- 
  23.     Total shows:   1146 
  24.     Soundboards:   800 
  25.     Auds       :   70 
  26.     Unknown    :   29 
  27.     Partial    :   9 
  28.     Broken     :   4 
  29.     MD5's check:   489 (42.67 %) 
  30. #> 
  31. ### 
  32. # Start of Archive 
  33. ## 
  34.  
  35. # Constants: 
  36. # $GDDiskRoot    - where to find shows 
  37. # $DeadShowBase  - folder at top of gd shows 
  38.  
  39. $GDDiskRoot     = "M:" 
  40. $DeadShowBase   = $GDDiskRoot + "\gd" 
  41.  
  42. # Announce Ourselves 
  43. "Count.ps1 - v 2.0.1" 
  44. "+---------------------------+" 
  45. "! Dead Show Base  :  $DeadShowBase  !" 
  46. "+---------------------------+" 
  47. "" 
  48.  
  49. # Count the Dead shows 
  50.  
  51. $Dir= ls $DeadShowBase  | where {$_.psiscontainer} 
  52. $DeadShows=$Dir.count 
  53. if ($DeadSHows -le 0) {"no shows found - check constants"} 
  54.  
  55. #Create subsets based on names of the folders 
  56. $deadsbds=$dir | where {$_.name -match ".sbd" } 
  57. $deadbrkn=$dir | where {$_.name -match "broken" } 
  58. $deadpart=$dir | where {$_.name -match "partial" } 
  59. $deadauds=$dir | where {$_.name -match ".aud" } 
  60. $deadunkw=$dir | where {$_.name -Match ".unk"} 
  61.  
  62. #and see how many have the md5ok's file? 
  63.  
  64. $DeadMD5Checked=0 
  65. foreach ($d in $dir) 
  66. {  
  67.   $sn=$d.fullname + "\md5check_ok" 
  68.   $md5ok= ls $sn -ea silentlycontinue 
  69.   if ($md5ok )  
  70.      {$DeadMD5Checked++} 
  71.  
  72. #Display results 
  73.  
  74. "Grateful Dead Show Summary" 
  75. "--------------------------" 
  76. "Total shows:   $deadshows" 
  77. "Soundboards:   $($deadsbds.count)" 
  78. "Auds       :   $($deadauds.count)" 
  79. "Unknown    :   $($deadunkw.count)" 
  80. "Partial    :   $($deadpart.count)" 
  81. "Broken     :   $($deadbrkn.count)" 
  82. $DeadPctChecked=($DeadMD5checked/$DeadShows).tostring("P"
  83. "MD5's check:   $DeadMD5checked ($DeadPctChecked)" 
  84. ""