Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
  #1  
Old February 14th, 2003, 10:14 PM
Aaron77 Aaron77 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 31 Aaron77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 39 sec
Reputation Power: 6
hashtables help

hi,
i am currently writing an audio program in vb 6.
i want it to be stand alone (no databases).

i have my music sorted in the following:
d:\music .....in this directory i have all the artist names
d:\music\artistname....in this directory i have all the album names
d:\music\artistname\albumname .....in this directory are the tracks

currently i am using classes for each of the above, however it is a mess. Should i use a hashtable or some sort of collection object for this.
i am currently getting the artist, album, track info by iterating through the directories.

on my search form i have a text field for the search criteria and i want to search on artist name or album name or track name.
when search is done i am displaying results in a flexgrid and i want the user to be able to click on an indivual track, album (get all tracks in order), or artist(get all albums) and then add to a playlist. which i will then pass to winamp. i've written this in access but attempting to do it in vb is proving to be a little tricky.

i would also like to sort the flexgrid data alphabetically as in:
artists, albums, sequencial order for tracks. eg.



also i have adopted the naming coventions of tracks as in:

01_the_first_song.mp3
02_the_second_song.mp3
03_the_third_song.mp3

artists and albums the same as far as no spaces, instead using underscores.

should i use hashtables?
i need all info to be relational like in a database as in
artists, albums, tracks tables except staying away from using a database.



hope this give a fair idea of what i want to achieve.

any thoughts / suggestions on how i should approach this problem would be greatly appreciated.

regards,

aaron.

Reply With Quote
  #2  
Old February 17th, 2003, 10:36 PM
Aaron77 Aaron77 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 31 Aaron77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 39 sec
Reputation Power: 6
also i forgot to mention:
when i read through the directories and files, they don't contain any spaces, only underscores...and i'm taking the underscore out so it's easier to search.


for instance i will read the artist directory "Alanis_Morisette"

and do...

ClassAlbumsArray(ClassAlbumsArrayLength).SetArtistID(ClassAlbumsArrayLength)


ClassAlbumsArray(ClassAlbumsArrayLength).SetArtistName("Alanis Morisette")

ClassAlbumsArray(ClassAlbumsArrayLength).SetPathName(D:\Music\Alanis_Morisette)


this works fine on my search form when i first load it because i iterate through the ClassAlbumsArray, ClassAlbumsArtistsArray, ClassTracksArray, and fill in the flexgrid. so when i click on a track name i can get the track id because its the reletive row in the flexgrid...however if i do a search on just say..alanis morisette, it won't be correct id cause all records arent' displayed.

unless i can make an extra column in the datagrid after searching and set it equal to the relevant id for the artist etc....and maybe hide the id column from the user.

will this help...any ideas anyone?


the classes ive written work only up until this point where i need to search.

for instance in a database i would have 3 tables:

Artists: ArtistID, ArtistName,ArtistPathName, etc

Albums: ArtistID, AlbumID, AlbumName, AlbumPath, etc

Tracks: AlbumID, TrackID, TrackName, TrackPath, TrackNumber,etc

....or something to that effect...my main problem is getting all the above relational for ease of searching without using a database because i want it to be stand-alone.

so would i be best using a class for artists, albums & tracks
and make them a resizable array....and then use hashtables somehow.

i am quite confused on which avenue to take so any input would be greatly appreciated.

regards,

Aaron.

Reply With Quote
  #3  
Old February 20th, 2003, 03:03 PM
epl epl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Dublin
Posts: 413 epl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 8
I would use a scripting.dictionary from the scripting runtime to store three separate tables of artists, albums and tracks. You may also want to hold a dictionary within each artist object containing a list of the child albums and likewise for the tracks within each album ... depending on how you'll want to use the data in searches etc.

Using the scripting.filesystemobject to query your drive will also solve your sorting issue as it returns subfolders and files in alphabetical order.

I have some sample code if you want to have a look through it.

Reply With Quote
  #4  
Old February 20th, 2003, 08:09 PM
Aaron77 Aaron77 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 31 Aaron77 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 39 sec
Reputation Power: 6
epl,

Thankyou very much for your reply, i greatly appreciate it.
If you could post some sample code for dictionary object in here to give me an idea that would be great.

...as far as searching goes, what i'd like to achieve is when my
search form first opens it will have a list of all music sorted in
alphabetic order, sorted by artistname, albumname, track order
in flexgrid so the user can browse through it at their leisure. Or alternatively do a search on artist, albumname, or track name (any combination) and then sort that in the same order in the flexgrid.
...then as the user clicks on tracks, albums, or artists append it to the playlist appropriately.

I was thinking maybe make a temporary array that would hold all the search results, sort of like a result set in a database.
do you think that is a good way of going about it?


kindest regards,


Aaron.

Last edited by Aaron77 : February 20th, 2003 at 08:19 PM.

Reply With Quote
  #5  
Old February 21st, 2003, 10:28 AM
epl epl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Dublin
Posts: 413 epl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 8
I've tried to attach my sample code - i'll post a link to it if that doesn't work.

I'm not exactly clear on how you want your search form to work but I guess a temporary array or a collection / dictionary will do the trick for you. You can decide to either populate the array and apply a search routine or else place each item in it's sort order as you add them.

I guess it would be best to write classes for the all music / artist / album that contain the search routines as member and functions and which return the results in a(n) array / collection / dictionary. Or else just add a boolean flag to the artist / album / track data structure and have it contain whether the most recent include the given item as a result etc... lot's of options.

You could also package off the music object into an activex object and just call it from within your application for neatness.

Also MS Media Player 9 does all this - for what it's worth.
Attached Files
File Type: zip devshed.zip (17.5 KB, 410 views)

Reply With Quote
  #6  
Old February 22nd, 2003, 05:31 AM
epl epl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Dublin
Posts: 413 epl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 8
here it is as an activex class... it's not too fast on a large number of files but see what you think
Attached Files
File Type: zip devshed.zip (39.1 KB, 326 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > hashtables help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway