TYPE album
    albumid AS STRING * 12
    title AS STRING * 40
    artist AS STRING * 40
    label AS STRING * 40
    format AS STRING * 40
    country AS STRING * 40
    released AS STRING * 40
    genre AS STRING * 40
    style AS STRING * 40
    recordnumber AS INTEGER
    numberofrecords AS INTEGER
    sidenumber AS INTEGER
    numberoftracks AS INTEGER
    tracklistheader AS STRING * 3
    tracklistname AS STRING * 50
    tracklistlength AS STRING * 5
    tracklistcondition AS STRING * 40
    signed AS STRING * 40
    covercondition AS STRING * 40
    conditionoverall AS STRING * 12
    whenadded AS STRING * 20
    picturedisc AS STRING * 40
    picturedisccondition AS STRING * 40
    release AS STRING * 16
    sealeddisc AS STRING * 3
END TYPE

DIM aa AS STRING * 5
DIM aaa AS STRING * 5
DIM bb AS STRING * 40
DIM cc AS STRING * 5
DIM dd AS STRING * 12
DIM answer AS STRING * 1
DIM handle AS STRING * 40
DIM letters AS STRING * 16
start:
CLS
_FULLSCREEN
CLS
COLOR 1, 7
CLS
PRINT "Vinyl Record Collectors Database Version 0.99c Beta Release"
PRINT
PRINT "This program will allow you to start a simple database on all of the"
PRINT "Vinyl Records that are in your collection. It will ask you first for"
PRINT "A DISCOGS number eg: 2GHS 2017, and will ask you questions about that"
PRINT "vinyl album. All of the fields that are in DISCOGS are in this program."
PRINT
PRINT "Because its a random access database , the data records are not stored"
PRINT "in memory, instead they are stored on disk, and as you build up your"
PRINT "vinyl record database , you will be able to search your collection"
PRINT "easily for whatever you are looking for, and not only display the "
PRINT "Information, but also edit it. The program even asks you for information"
PRINT "on which tracks on your record skip or make pops."
PRINT
INPUT "Enter Your Name or Collectors Handle : ", handle
DIM Record AS album, palbumid AS STRING * 12, temp AS STRING * 50
OPEN "vinylrecorddatabase.dat" FOR RANDOM AS #1 LEN = LEN(Record)
CLS
DO
    SCREEN _NEWIMAGE(800, 600, 32)
    INPUT "Enter Discog record  : ", palbumid
    IF palbumid = "" THEN CLOSE: GOTO finish
    MaxRecord = LOF(1) \ LEN(Record)
    Recordnumber = Recordnumber = Recordnumber
    FOR i = 1 TO MaxRecord
        GET #1, i, Record
        IF Record.albumid = palbumid THEN 'we found the record
            PRINT 'view existing record
            PRINT "RECORD FOUND:"
            PRINT "Name of Record             : "; Record.title
            PRINT "Recording Artist(s)        : "; Record.artist
            PRINT "Label of this album        : "; Record.label
            PRINT "Format of this album       : "; Record.format
            PRINT "Country of This album      : "; Record.country
            PRINT "Release Date of this album : "; Record.release
            PRINT "Genre of this album        : "; Record.genre
            PRINT "Style of this album        : "; Record.style
            PRINT "Is it a Signed record      : "; Record.signed
            PRINT "Is it a picture Disc       : "; Record.picturedisc
            PRINT "Cover  Condition           : "; Record.covercondition
            PRINT "Record Condition           : "; Record.conditionoverall
            PRINT "Add this record on         : "; Record.whenadded
            PRINT "Sealed Record (NIP)        : "; Record.sealeddisc
            PRINT "Records in this album      : "; Record.numberofrecords
            FOR j = 1 TO Record.numberofrecords
                FOR x = 1 TO Record.numberoftracks
                    pat$ = "\  \    \                         \   \  \  \         \"
                    PRINT USING pat$; Record.tracklistheader; Record.tracklistname; Record.tracklistlength, Record.tracklistcondition
                NEXT
            NEXT

            Recordnumber = i
            EXIT FOR 'no need to search any more once we're found
        END IF
    NEXT
    IF Recordnumber = 0 THEN 'we didn't find anyone
        CLS
        PRINT
        PRINT "NEW RECORD:"
        Recordnumber = MaxRecord + 1
    END IF
    Record.albumid = palbumid
    PRINT "Discog ID: "; Record.albumid 'add a new record, or update an old one.

    INPUT "Enter Name of This Album         : ", Record.title
    INPUT "Enter Recording Artist(s)        : ", Record.artist
    INPUT "Enter Label of this album        : ", Record.label
    INPUT "Enter Format of this album       : ", Record.format
    INPUT "Enter Country of This album      : ", Record.country
    INPUT "Enter Release Date of this album : ", Record.release
    INPUT "Enter Genre of this album        : ", Record.genre
    INPUT "Enter Style of this album        : ", Record.style
    INPUT "Is it a Signed record            : ", Record.signed
    INPUT "Is it a picture Disc             : ", Record.picturedisc
    INPUT "Condition of the Cover  Overall  : ", Record.covercondition
    INPUT "Condition of the Record Overall  : ", Record.conditionoverall
    INPUT "When did you add this record     : ", Record.whenadded
    INPUT "Is the record sealed NIP         : ", Record.sealeddisc
    INPUT "How many records in this album   : ", Record.numberofrecords
    CLS
    FOR i = 1 TO Record.numberofrecords

        FOR j = 1 TO 2
            IF j = 1 THEN
                letters = LTRIM$(CHR$(i + 65))
            ELSEIF j = 2 THEN
                letters = LTRIM$(CHR$((i + 1 + 65)))
            END IF
            PRINT "Enter The Number of Tracks for Record # "; i; " Side # "; j
            INPUT "> ", Record.numberoftracks
            FOR x = 1 TO Record.numberoftracks
                PRINT "Track Number  :"; x; ":";
                temp = letters + LTRIM$(STR$(i))
                MID$(Record.tracklistheader, 4 * x - 3, 4) = (temp)
                PRINT "Track Name    :"; x; ":";
                INPUT "> ", temp
                MID$(Record.tracklistname, 4 * x - 3, 4) = (temp)
                PRINT "Track Length  :"; x; ":";
                INPUT "", temp
                MID$(Record.tracklistlength, 4 * x - 3, 4) = (temp)
                PRINT "Track Quality :"; x; ":";
                INPUT "", temp
                MID$(Record.tracklistcondition, 4 * x - 3, 4) = (temp)
            NEXT
        NEXT
    NEXT
    PUT #1, Recordnumber, Record
LOOP
RETURN
finish:
CLOSE #1
END


