Official eMule-Board: How To Add A Custom "known File" List. - Official eMule-Board

Jump to content


Page 1 of 1

How To Add A Custom "known File" List.

#1 User is offline   arkeo 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 09-August 15

Posted 02 November 2019 - 01:38 PM

Hi Forum,

First of all, please, sorry if this isn't the right section, hope I'll be excused and mods will move my post.

Scenario: I would like to take into account all the files I am not interested in anymore. I could have deleted them and lost several emule files (known.met, etc.) but I have a text file where some info are stored.

To address the problem I would like to read a list of "known files" in text format, along with the list contained in known.met. For each file, the name, hash and size are known (I have such files, the data were read from old known.met files I processed and then deleted past years). I explored emule code and I think what I need to change is in KnownFileList.cpp function bool CKnownFileList :: LoadKnownFiles (). The main problem seems to me to be avoid collisions among files with the same hash, I suppose the structure of known.met is based on a unique hash in the list (possibly corresponding to more than one file name). My idea is to change the section where the records are read as follows. Of course, to be concise, I wrote a weird mix of code and pseudocode but I hope the organization will be clear anyway.

// MY_MODS: BEGIN ==================================

struct CPersonalList 
{
    struct  CMyKnownFile
    {
        string       fname    ;
        string       hash     ;
        uint64_t     size     ;
        bool         is_valid ;

        CMyKnownFile () { is_valid = true ; }
    } ;

    // various variables here...

    // functions

    void           load_all_entries (const char*) ;
    CMyKnownFile   *find_hash (const char*) ;
} ;

CPersonalList                  *mymods_list = new CPersonalList ;
CPersonalList::CMyKnownFile    *probe ;

(mymods_list->load_all_entries("my_filename.txt")) ;

// MY_MODS: END ====================================


for (UINT i = 0; i < RecordsNumber; i++) 
{
    pRecord = new CKnownFile();
    if( !pRecord->LoadFromFile(&file,I64Time) )
    {
        TRACE(_T("*** Failed to load entry %u (name=%s  hash=%s  size=%I64u  parthashs=%u expected parthashs=%u) from known.met\n"),
                  i,pRecord->GetFileName(),
                  md4str(pRecord->GetFileHash()), 
                  pRecord->GetFileSize(),
                  pRecord->GetFileIdentifier().GetAvailableMD4PartHashCount(), 
                  pRecord->GetFileIdentifier().GetTheoreticalMD4PartHashCount() );
        delete pRecord;
        pRecord = NULL;
        continue;
    }

    // MY_MODS: BEGIN ==================================
    if(  ( probe = (mymods_list->find_hash(md4str(pRecord->GetFileHash()) ) != NULL  )
        (probe->is_valid) = false ;
    // MY_MODS: END ====================================

    SafeAddKFile(pRecord);
    pRecord = NULL;
}

// MY_MODS: BEGIN ==================================

for(  my_list_begin ; my_list_end ; ++iterator ) // hope is clear anyway...
{
    probe = get_next_element (mymods_list) ;

    if(  (probe->is_valid) == true  )
    {
        pRecord = new CKnownFile();

        [color="#FF0000"]// PROBLEM HERE: how to assign all needed fields in pRecord???[/color]

        // assign fields do-not-know-how

        // insert additional record in known files list
        SafeAddKFile(pRecord);
        pRecord = NULL;
    }
}

// MY_MODS: END ====================================


I'm not a C ++ guru and eMule is a very large program, I don't know if there are any side effects with the above modification. Assuming that I can proceed as above, I don't know to assign the pRecord fields directly and not through the function that reads them from file. Is it possible without problems?

There is also the known_64.met file and I don't know if I have to take it into account. If so I am afraid that I should abandon my idea because of too many points where to get my hands.

I know that there are tools like metmedic and others that can merge different known.met files but they never worked for me, and as I said, I deleted many of them. Modifying the code seems to me the only way to deal with the problem.

Thank you for any advice.

This post has been edited by arkeo: 02 November 2019 - 03:51 PM

0

#2 User is offline   fox88 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 4974
  • Joined: 13-May 07

Posted 03 November 2019 - 12:26 PM

View Postarkeo, on 02 November 2019 - 04:38 PM, said:

To address the problem I would like to read a list of "known files" in text format, along with the list contained in known.met.

To get the list of all know files:
Go to Shared Files page, right click in the list
Select Connection - Create collection..., click on the button Shared()
Then save collection as a simple text file.
1

#3 User is offline   arkeo 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 11
  • Joined: 09-August 15

Posted 03 November 2019 - 02:59 PM

View Postfox88, on 03 November 2019 - 12:26 PM, said:

View Postarkeo, on 02 November 2019 - 04:38 PM, said:

To address the problem I would like to read a list of "known files" in text format, along with the list contained in known.met.

To get the list of all know files:
Go to Shared Files page, right click in the list
Select Connection - Create collection..., click on the button Shared()
Then save collection as a simple text file.


First of all thank you very much, I didn't know that feature and sooner or later it will be quite useful to me. Before posting my first post, I was afraid that I was unable to explain my problem because my English is poor, and I think that it is exactly what happened, so I try to detail my scenario a bit more.

My "known files" are no longer in my HD. I deleted them (and no trace of deleted files is in known.met or other .met file) because they no longer interested me, but before doing it I saved filename, hash and size in a text file. I'd like to tell eMule somehow that in case the same file (by hash of course) appeared in the search pane results, it were marked as known. Instead, it seems to me that the procedure you suggest assumes that the shared files are in the disk, but as I wrote that is not my case. Of course I could easily create a .emulecollection file with my data (those of deleted files) but as far as I remember, once loaded, eMule will start searching the files and download them. But they are exactly those file I am not interested in anymore, in fact I deleted them previously. Furthermore, I guess that since the above files were deleted eMule consider them as new files... Maybe there is some trick to make eMule do what I want but I don't know it.

Cheers :)

This post has been edited by arkeo: 03 November 2019 - 04:31 PM

0

#4 User is offline   stoatwblr 

  • Member
  • PipPip
  • Group: Members
  • Posts: 43
  • Joined: 15-February 13

Posted 14 June 2020 - 11:33 PM

View Postarkeo, on 03 November 2019 - 03:59 PM, said:

I'd like to tell eMule somehow that in case the same file (by hash of course) appeared in the search pane results, it were marked as known.


Add them to cancelled.met?
0

#5 User is offline   alexax 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 10
  • Joined: 16-July 20

Posted 17 July 2020 - 06:49 PM

thanks.
0

  • Member Options

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users