2
0
mirror of https://github.com/moebooru/moebooru synced 2025-09-02 15:05:11 +00:00

filter by file extension

--HG--
branch : moe
extra : convert_revision : svn%3A2d28d66d-8d94-df11-8c86-00306ef368cb/trunk/moe%4018
This commit is contained in:
petopeto
2010-05-02 23:02:19 +00:00
parent bb57bf7a33
commit 7f8dea877c
2 changed files with 8 additions and 1 deletions

View File

@@ -62,6 +62,11 @@ module PostSqlMethods
cond_params << q[:md5].split(/,/)
end
if q[:ext].is_a?(String)
conds << "p.file_ext IN (?)"
cond_params << q[:ext].downcase.split(/,/)
end
if q[:deleted_only] == true
conds << "p.status = 'deleted'"
else

View File

@@ -56,7 +56,7 @@ module TagParseMethods
q = Hash.new {|h, k| h[k] = []}
scan_query(query).each do |token|
if token =~ /^(unlocked|deleted|user|favtag|vote|-vote|fav|md5|-rating|rating|width|height|mpixels|score|source|id|date|pool|-pool|pool_posts|parent|order|change|holds|shown|limit):(.+)$/
if token =~ /^(unlocked|deleted|ext|user|favtag|vote|-vote|fav|md5|-rating|rating|width|height|mpixels|score|source|id|date|pool|-pool|pool_posts|parent|order|change|holds|shown|limit):(.+)$/
if $1 == "user"
q[:user] = $2
elsif $1 == "vote"
@@ -118,6 +118,8 @@ module TagParseMethods
end
elsif $1 == "deleted" && $2 == "true"
q[:deleted_only] = true
elsif $1 == "ext"
q[:ext] = $2
elsif $1 == "change"
q[:change] = parse_helper($2)
elsif $1 == "shown"