• Mystic mod/door question

    From m00p@46:2/105 to All on Sun May 8 17:09:37 2016
    Hi everyone,

    I would like to create a mod/door for Mystic that will allow me to display
    the 10 most recent uploads, also the most downloaded files from the board.

    Anyone got any idea on how do to this?

    --- Mystic BBS v1.12 A13 (Windows)
    * Origin: SLiME CiTY BBS (46:2/105)
  • From Gryphon@46:1/116 to m00p on Sun May 8 11:36:02 2016
    On 05/08/16, m00p said the following...

    Hi everyone,

    I would like to create a mod/door for Mystic that will allow me to
    display the 10 most recent uploads, also the most downloaded files from the board.

    Anyone got any idea on how do to this?

    You can find this on Cyberia:
    gy-nfb10.zip 5,518 04/29/16 New Files Bulletin v1.0 Bulletin

    Here's an unreleased MPL that will show the top 10 downloaded files. -----------------------------------
    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

    "No matter where you go, there you are!" - Buckaroo Bonzai

    --- Mystic BBS v1.12 A13 (Raspberry Pi)
    * Origin: Cyberia BBS | Cyberia.Darktech.Org | Kingwood, TX (46:1/116)
  • From Pequito@46:1/167 to Gryphon on Sun May 8 16:59:48 2016
    On 05/08/16, Gryphon said the following...

    I would like to create a mod/door for Mystic that will allow me to display the 10 most recent uploads, also the most downloaded files fr the board.

    Anyone got any idea on how do to this?

    You can find this on Cyberia:

    Doesnt the toplist do this already? Never used it but thought it was part of Mystic already.

    --- Mystic BBS v1.12 A13 (Windows)
    * Origin: Twinkle BBS | (46:1/167)
  • From Gryphon@46:1/116 to Pequito on Sun May 8 18:19:21 2016
    On 05/08/16, Pequito said the following...

    On 05/08/16, Gryphon said the following...

    I would like to create a mod/door for Mystic that will allow me display the 10 most recent uploads, also the most downloaded fil the board.

    Anyone got any idea on how do to this?

    You can find this on Cyberia:

    Doesnt the toplist do this already? Never used it but thought it was
    part of Mystic already.

    I think that the top lists only show the user top lists. It doesn't show anything for the files.

    "No matter where you go, there you are!" - Buckaroo Bonzai

    --- Mystic BBS v1.12 A13 (Raspberry Pi)
    * Origin: Cyberia BBS | Cyberia.Darktech.Org | Kingwood, TX (46:1/116)
  • From g00r00@46:1/127 to Gryphon on Wed May 11 02:31:49 2016
    Here's an unreleased MPL that will show the top 10 downloaded files. -----------------------------------

    Just a heads up:

    If you do not open/seek/close the file over and over, and instead use a loop with the buffered file i/o class, you should be able to make that run a million times faster than it probably does in the version you posted.

    Something like might help give you an idea, off the top of my head so it may not actually work:

    Type
    RecFileList = Record
    // mystic's .dir record
    End

    Var
    F : LongInt;
    List : RecFileList;
    Count : LongInt;
    Begin
    ClassCreate (F, 'File');

    Count := 1;

    While GetFBase(Count) Do Begin
    // for each file base.. open the .dir and read the files

    If FileOpen (F, CfgDataPath+FBaseFN+'.dir', SizeOf(List), 1, 66) Then
    Begin
    // read the entire .dir one record at a time...
    While Not FileEOF(F) Do Begin
    FileRead (F, List);
    // check if file is deleted and continue if it is
    If List.Flags And FDirDeleted <> 0 Then Continue;
    // do whatever with List record, add to top 10 etc if its a top10
    End

    FileClose(File);
    End;

    Count := Count + 1;
    End;

    ClassFree(File);


    ----

    The reason why this works faster is because not only are you not opening/seeking/closing for every record, but this file class will actually buffer the file for sequential reading by paging the file data in memory.

    An even faster way would be to use the same buffered class to read the
    file bases from a record.

    --- Mystic BBS v1.12 A14 (Windows)
    * Origin: Sector 7 [Mystic BBS WHQ] (46:1/127)
  • From Dream Master@46:1/145 to m00p on Thu May 12 04:22:21 2016
    on 05/08/16, m00p said...
    Hi everyone,
    I would like to create a mod/door for Mystic that will allow me to
    display the 10 most recent uploads, also the most downloaded files from the board.
    Anyone got any idea on how do to this?

    you can do it in mpl


    |08 ··[|15!|07dream master|15!|07DoRE|15!|07ACiDiC|15?|07demonic
    |08 ··[|15!|07dreamland|09.|07darktech|09.|07org

    --- Mystic BBS v1.10 (Windows)
    * Origin: d i s t o r t i o n // d1st.org (46:1/145)