• Top downloaded files?

    From deepthaw@21:2/136 to All on Wednesday, November 29, 2017 16:24:30
    Poking through the data structures, I see that it's not too hard to extract
    how many times each file has been downloaded (as in, it's literally just an integer in the record.)

    Is there already a door or other utility that will generate reports based on that? I'm not opposed to rolling my own, but just want to check before I duplicate effort.

    --- Mystic BBS v1.12 A36 2017/11/27 (Windows/32)
    * Origin: Deep Space '94 * telnet://deepspace94.com * fnord (21:2/136)
  • From dream master@21:1/163 to deepthaw on Wednesday, November 29, 2017 21:00:19
    On 11/29/17, deepthaw said the following...
    Is there already a door or other utility that will generate reports
    based on that? I'm not opposed to rolling my own, but just want to check before I duplicate effort.

    you can add the mci code to your file lister. that mci escapes me at the
    moment

    |08 .|05ú|13ù|15Dr|07e|08am Ma|07st|15er|13ù|05ú|08.
    |08 øù|05ú|13ùø |13øù|05ú|08ùø
    |11 DoRE|03!|11ACiDiC|03!|11Demonic |08[|15dreamland|09.|15darktech|09.|15org|08]

    --- Mystic BBS v1.12 A36 2017/11/28 (Windows/64)
    * Origin: |08--[|15!|07dreamland BBS dreamland.darktech.org (21:1/163)
  • From Gryphon@21:1/120 to deepthaw on Thursday, November 30, 2017 16:20:00
    On 11/29/17, deepthaw said the following...

    Poking through the data structures, I see that it's not too hard to extract how many times each file has been downloaded (as in, it's literally just an integer in the record.)

    Is there already a door or other utility that will generate reports
    based on that? I'm not opposed to rolling my own, but just want to check before I duplicate effort.

    Try this. It's been a while since I tried it. You may need to update the RecFileList structure from the records.112 file if it doesn't work.

    -----------8<------------------
    Uses Cfg
    Uses FBase

    Const MaxList = 11

    Type
    RecFileList = Record
    FileName : String[70];
    Size : LongInt;
    DatTim : LongInt;
    Uploader : String[30];
    Flags : Byte;
    Downloads : LongInt;
    Rating : Byte;
    DescPtr : LongInt;
    DescLines : Byte;
    End;

    Type
    RecTopTen = Record
    FileName : String[70]
    Downloads: LongInt;
    End

    Var FileInfo : RecFileList
    Var TopTen : Array [1..MaxList] of RecTopTen
    Var TTI : Byte = 0

    Procedure Insert2TT(FN:String;DL:LongInt)
    Var L,X : Byte
    Var TT : RecTopTen
    Begin
    TopTen[MaxList].FileName:=FN
    TopTen[MaxList].DownLoads:=DL
    For L:=1 To MaxList-1 Do Begin
    For X:=1 To maxList-1 Do Begin
    If TopTen[X+1].DownLoads> TopTen[X].DownLoads Then Begin
    TT:=TopTen[X]
    TopTen[X]:=TopTen[X+1]
    TopTen[X+1]:=TT
    End
    End
    End
    End

    Function ReadDirEntry(FN:String;I:Integer):Boolean
    Var Fp : File
    Var Dir : String
    Var Ret : Boolean = False
    Begin
    Dir:=CfgDataPath+FN+'.dir'
    fAssign(Fp,Dir,66)
    fReset(Fp)
    If IoResult = 0 Then Begin
    fSeek(Fp,(I-1)*SizeOf(FileInfo))
    If Not fEof(Fp) Then Begin
    fRead(Fp,FileInfo,SizeOf(FileInfo))
    Ret:=True
    End
    fClose(Fp)
    End
    ReadDirEntry:=Ret
    End

    Procedure ReadDLs
    Var I,D : Integer = 1
    Begin
    D:=1
    While GetFBase(D) Do Begin
    I:=1
    While ReadDirEntry(FBaseFN,I) Do Begin
    Insert2TT(FileInfo.FileName,FileInfo.Downloads)
    I:=I+1
    End
    D:=D+1
    End
    End

    Procedure Main
    Var I : Integer
    Begin
    ClrScr
    ReadDLs
    For I:=1 To MaxList-1 Do Begin
    WriteLn(PadRt(TopTen[I].FileName,25,' ')+' '+Int2Str(TopTen[I].Downloads))
    End
    pause
    End

    Procedure Init
    Var I : Byte
    Begin
    For I:=1 To MaxList-1 Do Begin
    TopTen[I].FileName:=''
    TopTen[I].Downloads:=0
    End
    TTI:=0
    End

    Begin
    Init
    Main
    End

    --- Mystic BBS v1.12 A35 (Linux/64)
    * Origin: Cyberia BBS | cyberia.darktech.org | San Jose, CA (21:1/120)
  • From g00r00@21:1/108 to Gryphon on Thursday, November 30, 2017 22:31:12
    Try this. It's been a while since I tried it. You may need to update
    the RecFileList structure from the records.112 file if it doesn't work.

    The structure hasn't changed so it still should be good to go. I have planned to add something into MUTIL since it has the Top 10 generator already but I don't know when I will. I need to redo the top 10 and the file list generator.

    This scripts speed could be massively improved by not opening and seeking and closing for each record, and by using the buffered file IO class! Something like this:

    Var
    FileList : RecFileList;

    Begin
    // Create buffered file reader

    ClassCreate(DirFile, 'File');

    // If opening the file base listing is okay, read each record and process

    If FileOpen(DirFile, CfgDataPath + FBaseFN + '.dir', SizeOf(FileList), 1,
    66) Then Begin

    While Not FileEOF(DirFile) Do Begin
    FileRead (DirFile, FileList); // read next record in file list

    // process record for top10 list
    End;
    End;

    // dispose of the file class which will also close the datafile too

    ClassFree(DirFile);
    End.

    --- Mystic BBS v1.12 A36 2017/11/30 (Windows/64)
    * Origin: Sector 7 [Mystic BBS WHQ] (21:1/108)
  • From Gryphon@21:1/120 to g00r00 on Thursday, November 30, 2017 20:47:26
    On 11/30/17, g00r00 said the following...

    This scripts speed could be massively improved by not opening and
    seeking and closing for each record, and by using the buffered file IO class! Something like this:

    I agree. But it served my purpose at the time.

    --- Mystic BBS v1.12 A35 (Linux/64)
    * Origin: Cyberia BBS | cyberia.darktech.org | San Jose, CA (21:1/120)