Search - File type

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Locked
Ragowit
Posts: 1
Joined: 2003-07-15 17:04
Location: Sweden
Contact:

Search - File type

Post by Ragowit » 2004-11-29 16:23

First, this post might be completly wrong, move it, lock it, delete it... Sorry.

Second, the bugzilla doesn't work. Have tried to register three times with different emails, and I haven't got any email yet from it so far with the activation stuff...

So, the bug I think I have found is that if I choose the file type Video in the Search screen, so doesn't it look for .mkv files. I quickly "scanned" the sourcecode and found that .mkv was included under "Video", but I think it was in the last position. Maybe a loop that ends one step to early?

This bug might also be on the other values (Audio, Compressed...).

Once again, I'm sorry if this post is completly misplaced...

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2004-11-29 16:48

I am not seeing that behaviour with 0.667. What version are you using?
The world is coming to an end. Please log off.

DC++ Guide | Words

PseudonympH
Forum Moderator
Posts: 366
Joined: 2004-03-06 02:46

Post by PseudonympH » 2004-11-29 22:23

Note that what filetypes are returned depends on the person being searched, not the one doing the searching (which can only specify a category). I'm not sure when .mkv was added; check the changelog.

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2004-12-24 22:29

Excuse my ignorance, but in which file in the sourcecode are the file types categorised as "video" etc?
I've had a look and can't see anything for the latest release. I was hoping to attempt a new function for my own use where I could click one button and search for 5 or 6 file types (which I don't permit on my own hub) at once rather than one at a time.

Thanks in advance

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2004-12-25 06:48

Sorry, I've found this in
client/ShareManager.cpp:

Code: Select all

static const char* typeAudio[] = { ".mp3", ".mp2", ".mid", ".wav", ".ogg", ".wma" };
static const char* typeCompressed[] = { ".zip", ".ace", ".rar" };
static const char* typeDocument[] = { ".htm", ".doc", ".txt", ".nfo" };
static const char* typeExecutable[] = { ".exe" };
static const char* typePicture[] = { ".jpg", ".gif", ".png", ".eps", ".img", ".pct", ".psp", ".pic", ".tif", ".rle", ".bmp", ".pcx" };
static const char* typeVideo[] = { ".mpg", ".mov", ".asf", ".avi", ".pxp", ".wmv", ".ogm", ".mkv" };

static const string type2Audio[] = { ".au", ".aiff", ".flac" };
static const string type2Picture[] = { ".ai", ".ps", ".pict" };
static const string type2Video[] = { ".rm", ".divx", ".mpeg" };
Why are ape and shn (off the top of my head) omitted from audio? If I ever figure out how to compile I'll have a go at adding these as well as having a custom category ("banned") for my use. Sounds simple when you say it fast.

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2004-12-25 07:36

expstevie wrote:Why are ape and shn (off the top of my head) omitted from audio? If I ever figure out how to compile I'll have a go at adding these as well as having a custom category ("banned") for my use. Sounds simple when you say it fast.
Things are never as simple as they seem. Making changes to your local definitions is irrelevant. The results you receive are from the other person. What results they send to you will be based on the list of extensions they have in their code. If they don't have ape and shn listed, you will never receive them, no matter what you do to your own client. Think about it.

Adding your own "type" is also limited like this, butt in a slightly more complex way.
The world is coming to an end. Please log off.

DC++ Guide | Words

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2004-12-25 08:28

OK - it seems as though I'm waiting for these to be added to an official release then.

Maybe someone can help with some other confusion. If I search for ".flac" then I obviously find lots of flac files (such as 08 Harvest.flac).
However, if I search for "Harvest" and choose "Audio" from the drop down list, I don't find the same file despite the pasted code, above, listing flac as a "type2audio".

I've tried this in v0.401 and 0.668
If it's as simple as "it's got to be listed in typeAudio[] = " then what does type2 do?
Anyone?

PseudonympH
Forum Moderator
Posts: 366
Joined: 2004-03-06 02:46

Post by PseudonympH » 2004-12-25 10:11

Most file extensions are 3 characters, so when combined with the '.' they can be compared using a 32-bit integer comparison. The ones that are not 3 characters need to be put in a string class and compared using string comparisons. That's what I think it's for, anyway. :)

Note that deciding what extensions to use is searcher-side under the ADC protocol.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-12-27 12:02

expstevie wrote:Maybe someone can help with some other confusion. If I search for ".flac" then I obviously find lots of flac files (such as 08 Harvest.flac).
However, if I search for "Harvest" and choose "Audio" from the drop down list, I don't find the same file despite the pasted code, above, listing flac as a "type2audio".
Presumably the results are different because the user's .flac files are more than 10 results into their matches for "Harvest." Or, you could be on a hub with many different DC++ versions - you need to look at the changelog to see which version a given extension was added at.
PseudonympH wrote:That's what I think it's for, anyway.
Correct.

PseudonympH
Forum Moderator
Posts: 366
Joined: 2004-03-06 02:46

Post by PseudonympH » 2004-12-27 16:20

Allow me to give myself a cookie.

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2004-12-27 20:23

Excuse my dumbness, lol.

True or false (in any version of DC++, or for simplicity, the recent 0.668):

1. Searching for files with a 3 letter file extension is carried out using a different technique than doing the same for a file with a 4 letter file extension.

2. If one user has 13 files which all include the string "Harvest" and I search for the string "Harvest" I'll find them all. If they have 13 .flac files and I search for "Harvest" in file type "Audio", I'll only find it if it's among the first 10 files found.

3. It's possible that "flac" files were not previously considered as "audio" and a changelog would show their introduction. It's possible that flac aren't really considered as audio (at least not as commonly as mp3 & this is reflected in the code for DC++) as they are included only in type2Audio rather than alongside mp3 in typeAudio.

4. In this same vein, the future inclusion of the yet to be introduced "ape" and "shn" as audio types is a simple change (in terms of code change, based on my quoted code excerpt, above).


Thanks in advance, all, you've been really helpful so far.

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2004-12-28 07:03

expstevie wrote:2. If one user has 13 files which all include the string "Harvest" and I search for the string "Harvest" I'll find them all. If they have 13 .flac files and I search for "Harvest" in file type "Audio", I'll only find it if it's among the first 10 files found.
No. You will only ever receive 10 search results in active mode and 5 in passive mode. I think which results you receive are non-deterministic.
expstevie wrote:3. It's possible that "flac" files were not previously considered as "audio" and a changelog would show their introduction.
Yes.
expstevie wrote:4. In this same vein, the future inclusion of the yet to be introduced "ape" and "shn" as audio types is a simple change (in terms of code change, based on my quoted code excerpt, above).
Yes, but with the restrictions outlined above. ie. it has to be a global change. Not just on an individual basis.

I don't have definitive answers for the other questions.
The world is coming to an end. Please log off.

DC++ Guide | Words

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-12-28 12:35

expstevie wrote:True or false (in any version of DC++, or for simplicity, the recent 0.668):
What if part is true, and part is false? Or if the "truness" depends on context you didn't put in the question?
1. Searching for files with a 3 letter file extension is carried out using a different technique than doing the same for a file with a 4 letter file extension.
true: DC++'s source code matches extensions differently for 3 and !3 letter extensions
false: Users will never see this difference, it's only in the source code.
2. If one user has 13 files which all include the string "Harvest" and I search for the string "Harvest" I'll find them all. If they have 13 .flac files and I search for "Harvest" in file type "Audio", I'll only find it if it's among the first 10 files found.
false: search results are limited to 10 in response to an active search, and 5 in response to passive searches.

If they have 13 .flac files containing "Harvest" (remember, path matches count too), audio or no type doesn't matter. Your scenario is constructed badly. ;)
3. It's possible that "flac" files were not previously considered as "audio" and a changelog would show their introduction. It's possible that flac aren't really considered as audio (at least not as commonly as mp3 & this is reflected in the code for DC++) as they are included only in type2Audio rather than alongside mp3 in typeAudio.
FYI, changelog.txt says:

Code: Select all

 -- 0.402 2004-06-27 --
* .mkv and .flac added as file formats (thanks garg)
type2Audio and typeAudio don't matter, to you, as a user. They're purely source-code optimizations to save some CPU time for 3 letter extensions.
4. In this same vein, the future inclusion of the yet to be introduced "ape" and "shn" as audio types is a simple change (in terms of code change, based on my quoted code excerpt, above).
Yes, adding those extensions is a change to the typeAudio array. Making the extension list longer introduces more comparisons. If you have many files that don't fall into the listed extensions, this theoretically might lead to measurable CPU usage. Basically, only popular file types should go there, avoiding bloat, and corresponding with what "popular" extensions are shared.

IMO, .ape and .shn should be converted to FLAC, since it's free-as-in-speech, which isn't the same as Monkey or Shorten. And, if you're storing lossless audio, you obviously don't care about disk space. =) Foobar2000 can do this easily, while preserving tags.

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2005-01-14 09:30

ape and shn are free too. I know that shn is seen as a bit crap but I've nothing against ape files.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-14 13:05

expstevie wrote:ape and shn are free too. I know that shn is seen as a bit crap but I've nothing against ape files.
Ape's license agreement:
License Agreement

1. The use of any of the Monkey’s Audio source code or any component thereof from another program requires express written permission from the author of Monkey’s Audio.

2. The use of Monkey's Audio or the Monkey's Audio source code for any commercial purposes including, but not limited to, implementation in shareware packages is strictly prohibited without first obtaining written permission from the author.

3. All code changes and improvements must be contributed back to the Monkey's Audio project free from restrictions or royalties for the sake of the common good.

4. Although the software has been tested thoroughly, the author is in no way responsible for damages due to bugs or misuse.

5. If you do not completely agree with all of the previous stipulations, you must cease using this source code and remove it from your storage device.
It's not free-as-in-speech.

Shorten
http://freshmeat.net/projects/shorten wrote:[License] Free for non-commercial use
Therefore, it is also not free-as-in-speech.

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2005-01-14 20:18

Oh, sorry! I just meant that it doesn't cost us all anything to download and use Monkey's Audio. That's free enough for me so far as a user.

Seeing as ape files at Extra High compression are smaller than flac files - is there any hope of them being added to typeAudio? Sometimes audio *has* to be lossless
If need be I could code it myself & add "DC++ Contributor" to my CV.

Code: Select all

static const char* typeAudio[] = { ".mp3", ".mp2", ".mid", ".wav", ".ogg", ".wma", ".ape" }; 

joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 02:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2005-01-15 01:54

This will be possible in the ADC protocol as you there can specify extension when searching. http://dcplusplus.sourceforge.net/ADC.htm#_Toc89885799

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2005-01-16 17:50

Cheers joakim but doesn't that say that you can only specify one file extension in your search? Also that way my CV gets no extra work ;-)

PseudonympH
Forum Moderator
Posts: 366
Joined: 2004-03-06 02:46

Post by PseudonympH » 2005-01-17 11:38

Incorrect.
String search term, where ++ is include, -- is exclude, and EX is extension. Each filename (including the path to it) should be matched using case insensitive substring search as follows: match all ++, remove those that match any --, and make sure the extension matches at least one of the EX (if it is present).

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-17 12:14

expstevie wrote:If need be I could code it myself & add "DC++ Contributor" to my CV.
A single patch would technically be a contributor. If you have some better title for me, feel free to name it. ;)
expstevie wrote:That's free enough for me so far as a user.
True, but in 20 years, you'll still be able to use FLAC, make hardware players for it, etc. You'll also have the same freedom to adapt DC++ source to the current computers, too - something you wouldn't be able to do with NMDC or Monkey Audio.

Locked