Advertisement
Advertisement
| 02.24.2008 at 02:57PM PST, ID: 23188953 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: |
Private Sub GetNonPlaylistTracks()
'Declare variables & create temporary table
Dim objMainPlaylists As IITPlaylistCollection = objITunes.LibrarySource.Playlists
Dim tblPlaylistTracks As DataTable = New DataTable("tblPlaylistTracks")
Dim intTeller As Integer = 1
Dim strPlaylists As String = ""
'Call procedure to set items on the main form
SetMenuItems("GetNonPlaylistTracks Start")
'Clear the datatable
dsiTunes.Tables("tblOrphins").Clear()
'Create a column in the temporary table
Dim colTrackID As DataColumn
colTrackID = New DataColumn
With colTrackID
.DataType = System.Type.GetType("System.Int32")
.ColumnName = "TrackID"
End With
tblPlaylistTracks.Columns.Add(colTrackID)
'Loop through the entire playlists object
Do Until intTeller = objMainPlaylists.Count
'Update statuslabel on main form
lblStatus.Text = "Enumerating playlists... " & intTeller & "/" & objMainPlaylists.Count
Dim objCurPlaylist As IITPlaylist = objMainPlaylists.Item(intTeller)
'Find playlists in the playlists object that are only user and not smart playlists
If objCurPlaylist.Kind = ITPlaylistKind.ITPlaylistKindUser Then
Dim objUserPlaylist As IITUserPlaylist = objCurPlaylist
If objUserPlaylist.Smart = False And objUserPlaylist.SpecialKind = ITUserPlaylistSpecialKind.ITUserPlaylistSpecialKindNone Then
Dim objPlaylistTracks As IITTrackCollection = objCurPlaylist.Tracks
For Each objCurTrack As IITTrack In objPlaylistTracks
'Store each track inside this playlist in the temporary table
Dim rowPlaylistTrack As DataRow = tblPlaylistTracks.NewRow
rowPlaylistTrack("TrackID") = objCurTrack.TrackDatabaseID
tblPlaylistTracks.Rows.Add(rowPlaylistTrack)
Next
End If
End If
'Increment counter
intTeller = intTeller + 1
'Update progressbar on main form
pgbTotal.Value = (intTeller / objMainPlaylists.Count) * 50
Application.DoEvents()
Loop
'Reset counter
intTeller = 0
'Create new dataview of temporary table & sort
Dim view As DataView = New DataView(tblPlaylistTracks)
view.Sort = "TrackID"
'Loop trough the track collection
For Each objTrack As IITTrack In objTracks
'Update statuslabel on main form
lblStatus.Text = "Checking Track No: " & intTeller & "/" & objTracks.Count
'If the current track is found inside the temporary table, add it to the table inside the dataset on the main form
If view.Find(objTrack.TrackDatabaseID) = -1 Then
Dim rowNonPlaylistTrack As DataRow = dsiTunes.Tables("tblOrphins").NewRow
rowNonPlaylistTrack("ID") = objTrack.TrackDatabaseID
rowNonPlaylistTrack("Name") = objTrack.Name
rowNonPlaylistTrack("Album") = objTrack.Album
rowNonPlaylistTrack("Artist") = objTrack.Artist
rowNonPlaylistTrack("Size") = Math.Round((objTrack.Size / 1024)) & " KB"
rowNonPlaylistTrack("Location") = objTrack.Location
dsiTunes.Tables("tblOrphins").Rows.Add(rowNonPlaylistTrack)
End If
'Increment counter
intTeller = intTeller + 1
'Update progressbar on main form
pgbTotal.Value = 50 + ((intTeller / objTracks.Count) * 50)
Application.DoEvents()
Next
'Clear out temporary table
tblPlaylistTracks.Clear()
'Call procedure to set items on the main form
SetMenuItems("GetNonPlaylistTracks Complete")
End Sub
|