Page 17 of 35 FirstFirst ... 7151617181927 ... LastLast
Results 161 to 170 of 349

Thread: HOWTO: Install LinuxDC++

  1. #161
    Join Date
    Aug 2005
    Location
    Italy
    Beans
    25
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: HOWTO: Install LinuxDC++

    Quote Originally Posted by stevensheehy View Post
    You can send it to our mailing list, if you'd like (the list allows sending without having to register first). You can also post it here in this thread (in a code iframe).
    By the list you mean the developer's list accessible through berlios?

    Constructive criticism greatly appreciated. This code is probably not very pythonesque (nor efficient) but it was fun fiddling with. The script either traverses the sharelist xml or the filesystem (for historical reasons mostly, using 'find'). Save to e.g. sharecheck.py and run: ./sharecheck.py --help

    Code:
    #!/usr/bin/python
    
    # Copyright (C) 2007 Rasmus Larsson 
    #
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # Read the full license agreement here: http://www.gnu.org/licenses/gpl.txt
    
    import os, sys, getopt, bz2, fnmatch
    from xml.dom import minidom
    
    DEFSEARCHSTRS = ['Descript.ion','thumbs.db','*.html','*.htm','*.msg','*.permissions','*.pls','*.status','*.url','*.filled','*.debug','*.ccd','*.ioFTPD*','*.banana','*.bad','*.checked','*.raidenftpd.acl','*.SimSfvChk.log','*.message','*.upChk.log','*.crc','imdb.nfo','*.bc!','*(1).nfo','*(2).nfo','*(3).nfo','*.log','*.pls','*.dctmp','*(1).sfv','*.ini','*.bak','*(2).sfv','*.dt!','*.bat','*.ink','*missing','*.antifrag']
    
    #DEFSEARCHSTRS= ['*.srt','*.sub','*.idx'] #removed
    DEFSOURCE="bz2"
    DCCONFFILE='~/.dc++/DCPlusPlus.xml'
    DCSHAREFILE='~/.dc++/files.xml.bz2'
    
    class DCFileHandler:
    	""" Opens the DC++ config file and share list file. """
    	def __init__(self, configfile='~/.dc++/DCPlusPlus.xml', sharelistfile='~/.dc++/files.xml.bz2'):
    		"""
    		configfile -- location and name of configfile relative to the userdirectory, default is ~/.dc++/DCPlusPlus.xml
    		sharelistfile -- location and name of the sharelistfile relative to the userdirectory, default is ~/.dc++/files.xml.bz2
    		"""
    		self.xmldirlist = self.extractShareDirectories(configfile)
    		self.xmlsharelist = self.extractSharelist(sharelistfile)
    
    	def expandUserDir(self, string):
    		if(string[0]=='~'): return os.path.expanduser(string)
    		else: return string
    
    	def extractShareDirectories(self, configfile):
    		"""Extract the share directories from DCPlusPlus.xml"""
    		try:
    			fsock_conf = file(self.expandUserDir(configfile))
    			xmldoc = minidom.parse(fsock_conf)
    			fsock_conf.close()
    			return xmldoc
    		except IOError:
    			print IOError
    			sys.exit(2)
    
    	def extractSharelist(self, sharelistfile):
    		try:
    			fsock_share = bz2.BZ2File(self.expandUserDir(sharelistfile))
    			xmlsharelist = minidom.parse(fsock_share)
    			fsock_share.close()
    			return xmlsharelist
    		except IOError:
    			print IOError
    			sys.exit(2)
    
    class DCAnalyzer:
    	def __init__(self, dcfh):
    		self.dcfilehandler = dcfh
    		self.createDirMap()
    
    	def lookupShareDirPath(self, dirname):
    		"""Lookup the complete path (dir included) of a directory."""
    		return self.dirmap[dirname]
    
    	def createDirMap(self):
    		sharedirlist = self.dcfilehandler.xmldirlist.getElementsByTagName('Share') #parametrize?
    		firstref = sharedirlist[0]
    		dirlist = firstref.getElementsByTagName('Directory') #parametrize?
    		self.dirmap = {} 
    		for dir in dirlist:
    			self.dirmap[ dir.attributes['Virtual'].value ] = dir.firstChild.data 
    
    	def search(self, searchstrings, source="bz2"):
    		"""
    		searchstrings -- list of search strings to look for
    		source -- where to look for the files, in the share list ("bz2", default) or in the file system ("fs")
    		"""
    		if(source == "bz2"):
    			return self.searchbz2(searchstrings)
    		elif(source == "fs"):
    			return self.searchfs(searchstrings)
    		else:
    			raise Error, source + " is an unknown source"
    
    	def searchfs(self, searchstrings):
    		""" Search the share directories (using unix 'find') for files matchin search strings.
    		searchstrings -- list of search strings
    		"""
    		print "Searching filesystem...\n\n"
    		print 'Search strings are: ' 
    		print searchstrings
    
    		print 'Share directories are:'
    		for key in self.dirmap:
    			#print var.firstChild.data
    			print self.dirmap[key]
    		print "\n"
    		
    		files=[]
    		for key in self.dirmap:
    			for str in searchstrings: 
    				cmd = 'find ' + self.dirmap[key] + ' -name \'' + str  + '\' -print' 
    				o = os.popen(cmd)
    				foo = o.read()
    				if ( len(foo) > 0 ):
    					files.append(foo)
    		return files
    
    	def searchbz2(self, searchstrings):
    		print "Searching sharelist...\n\n"
    		files=[]
    		foundElements=[]
    		filelist = self.dcfilehandler.xmlsharelist.getElementsByTagName('File') #parametrize?
    		for elementFile in filelist:
    			for pattern in searchstrings:
    				filename = elementFile.attributes['Name'].value
    				if (fnmatch.fnmatch(filename,pattern)):
    					foundElements.append(elementFile)
    		
    		for element in foundElements:
    			pnames=[]
    			parents = self.recurseParents(element.parentNode, 'Directory') #parametrize?
    			for pelement in parents:
    				pnames.append(pelement.attributes['Name'].value)		
    							
    			path = self.lookupShareDirPath(pnames.pop(0))
    			for pname in pnames:
    				path += pname + "/"
    			path += element.attributes['Name'].value
    			files.append( path )
    		
    		return files	
    
    	def recurseParents(self, parent, name):
    		"""Recurses the parent and all its parents having 'name' and returns a list of them."""
    		list=[]
    		if (parent.parentNode is not None
    			and parent.parentNode.nodeName == name):
    			list.extend(self.recurseParents(parent.parentNode, name))
    		list.append(parent)
    		return list
    
    def getArgs():
    	"""Gets the input arguments if there are any."""
    	myArgs={}
    	searchstrings = [] 
    	configfile=None
    	sharelistfile=None
    	source=None
    	try:
    		opts, args = getopt.getopt(sys.argv[1:], "he:f:s:", ["help","pattern=","configfile=","sharelistfile="])
    	except getopt.GetoptError:
    		usage()
    		exit(2)
    	for opt, arg in opts:
    		if opt in ("-h", "--help"):
    			usage()
    			sys.exit(2)
    		elif opt in ("-e", "--pattern"):
    			searchstrings.append(arg)
    		elif opt in ("-c", "--configfile"):
    			configfile=arg
    		elif opt in ("-f","--sharelistfile"):
    			sharelistfile=arg
    		elif opt in ("-s","--source"):
    			source=arg
    			
    	if(len(searchstrings) == 0):
    		searchstrings = None
    	myArgs["sharelistfile"]=sharelistfile
    	myArgs["configfile"]=configfile
    	myArgs["searchstrings"]=searchstrings
    	myArgs["source"]=source
    	return myArgs
    
    def usage():
    	"""Prints the correct usage of the program"""
    	print "This program searches your linuxdc++ share for files with specified search pattern.\
    		\nIt may work on windows as well, but I haven't tried."
    	print "Usage:\tsharecheck.py [-h|-e PATTERN*|-c FILEPATH|-f FILEPATH|-s SOURCE] -e\n\t-h, --help shows this help \
    		\n\t-e, --pattern=[PATTERN] use PATTERN as search expression \
    		\n\t-c, --configfile=[FILEPATH] use FILEPATH file as DC++ config file, default is ~/.dc++/DCPlusPlus.xml \
    		\n\t-f, --sharelist=[FILEPATH] use FILEPATH file as DC++ sharelist file, default is ~/.dc++/files.xml.bz2 \
    		\n\t-s, --source=[SOURCE] look in SOURCE ('bz2'|'fs') (sharelist or filesystem) for files, default is bz2\
    		\n\nNotes: \
    		\n\t- Search is performed using fnmatch syntax. 'man fnmatch' for details.\
    		\n\t- more than one search pattern is permitted.\
    		\n\nExample: \
    		\n\t./sharecheck.py -e imdb.* -e Thumbs* -s fs\n\n "
    
    def run():
    	myArgs = getArgs()
    	searchstrings = DEFSEARCHSTRS
    	configfile = DCCONFFILE
    	sharelistfile = DCSHAREFILE
    	source = DEFSOURCE
    	if(myArgs["searchstrings"] is not None):
    		searchstrings = myArgs["searchstrings"]
    	if(myArgs["configfile"] is not None):
    		configfile = myArgs["configfile"]
    	if(myArgs["sharelistfile"] is not None):
    		sharelistfile = myArgs["sharelistfile"]
    	if(myArgs["source"] is not None):
    		source = myArgs["source"]
    	dcfh = DCFileHandler(configfile, sharelistfile)
    	dca = DCAnalyzer(dcfh)
    	list = dca.search(searchstrings, source)
    	for l in list:
    		print l
    
    run()
    Reality is what you make of it.

  2. #162
    Join Date
    Apr 2007
    Beans
    1

    Re: HOWTO: Install LinuxDC++

    Really good job there, thanks alot =)

  3. #163
    Join Date
    May 2005
    Beans
    Hidden!

    Re: HOWTO: Install LinuxDC++

    Will there ever be a core/gui seperation in linuxdcpp?

    It's the thing I miss the most...

    Museek has it - http://museek-plus.org/ - but that's a slsk client...

    I can ssh into my server, start museekd (the core) in a screen session (without x) and detach it, end my ssh session and the core will keep on running. It's genius! When I want to search files or chat I just connect to the core on my notebook with the QT, GTK or ncurses GUI.

    That's why my slsk is on almost 24/7 but I rarely ever use LinuxDC++ anymore.

    Soo...any chance that there will be a core/gui seperation any time soon?

  4. #164
    Join Date
    Feb 2007
    Location
    Bucharest
    Beans
    460
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: Install LinuxDC++

    On the first command (sudo apt-get install cvs scons build-essential libgtk2.0-dev libglade2-dev zlib1g-dev libbz2-dev libssl-dev) it says it has to download 92.7MB to my harddisk. Is that normal? I'm a valknut user and it only uses like 12MBs, but I don't quite like it and LinuxDC++ sounds much better... but 92.7MB seems a bit high...

  5. #165
    Join Date
    Aug 2005
    Location
    Italy
    Beans
    25
    Distro
    Kubuntu 7.04 Feisty Fawn

    Re: HOWTO: Install LinuxDC++

    Quote Originally Posted by Znupi View Post
    On the first command (sudo apt-get install cvs scons build-essential libgtk2.0-dev libglade2-dev zlib1g-dev libbz2-dev libssl-dev) it says it has to download 92.7MB to my harddisk. Is that normal? I'm a valknut user and it only uses like 12MBs, but I don't quite like it and LinuxDC++ sounds much better... but 92.7MB seems a bit high...
    Those are not linuxdc++, but other libraries linuxdc++ uses (build environment, header files and so forth) and probably contain a whole lot more than just what is used by linuxdc++. I'm not sure how big they are together but it doesn't sound way off with ~90MB. The source files for linuxdc++ itself are around 11MB in total.
    Reality is what you make of it.

  6. #166
    Join Date
    Nov 2006
    Location
    Toulouse
    Beans
    13
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO: Install LinuxDC++

    Hi,

    I am a user of linuxdcpp and it works great for me ! But I have some little problems :
    - the icon in the task bar is not transparent (there is a white frame on it whereas the .png is really transparent)
    - the number of search results seems to be limited (around 60-70) but it seems to be wanted by the protocol : I am the admin of the hub (ptokax) but I don't see any option to change it.
    - the search engine does not work very well with accents (I am french) : when you search for "vidéo", it should be able to return files with a name containing "video" !

    Again, thanks for all the work done here !

  7. #167
    Join Date
    Mar 2006
    Beans
    133
    Distro
    Ubuntu 6.06

    Re: HOWTO: Install LinuxDC++

    Quote Originally Posted by stokedfish
    Will there ever be a core/gui seperation in linuxdcpp?
    http://openfacts.berlios.de/index-en...tle=Ldcpp_Todo
    See 6th bullet down. Gonna be awhile, though.

    Quote Originally Posted by Znupi View Post
    On the first command (sudo apt-get install cvs scons build-essential libgtk2.0-dev libglade2-dev zlib1g-dev libbz2-dev libssl-dev) it says it has to download 92.7MB to my harddisk. Is that normal? I'm a valknut user and it only uses like 12MBs, but I don't quite like it and LinuxDC++ sounds much better... but 92.7MB seems a bit high...
    It's only because you're compiling from source and don't already have the compiler tools and other libraries. You need most of these anyway if you're every going to compile anything else on Ubuntu.

    Quote Originally Posted by stokedfish
    The source files for linuxdc++ itself are around 11MB in total.
    The source is 2.3 MB. ~340KB if compressed.

  8. #168
    Join Date
    Mar 2006
    Beans
    133
    Distro
    Ubuntu 6.06

    Re: HOWTO: Install LinuxDC++

    Quote Originally Posted by Bapman View Post
    - the icon in the task bar is not transparent (there is a white frame on it whereas the .png is really transparent)
    The task bar icon shows up fine for me. If it doesn't show transparent for you, it is an issue with either your system. If, however, you mean the system/task tray instead of the task bar, then that is a known problem.

    Quote Originally Posted by Bapman View Post
    - the number of search results seems to be limited (around 60-70) but it seems to be wanted by the protocol : I am the admin of the hub (ptokax) but I don't see any option to change it.
    There is no such limit in linuxdcpp, the problem lies elsewhere.

    Quote Originally Posted by Bapman View Post
    - the search engine does not work very well with accents (I am french) : when you search for "vidéo", it should be able to return files with a name containing "video" !
    Make sure you have the encoding set properly. The NMDC protocol does not specify a text encoding, so you have to manually set it yourself. Go into Preferences and change your "Default Hub Encoding". You can also change it per-hub on the favorite hubs tab.

  9. #169
    Join Date
    Mar 2006
    Beans
    133
    Distro
    Ubuntu 6.06

    Re: HOWTO: Install LinuxDC++

    By the way, I need someone to test if this guide works on Feisty. I'm probably not going to be upgrading for awhile (if at all), so I need someone else to test. Thanks.

  10. #170
    Join Date
    Nov 2005
    Location
    Poland
    Beans
    202

    Re: HOWTO: Install LinuxDC++

    Quote Originally Posted by stevensheehy View Post
    By the way, I need someone to test if this guide works on Feisty. I'm probably not going to be upgrading for awhile (if at all), so I need someone else to test. Thanks.
    It worked for me in Feisty.

Page 17 of 35 FirstFirst ... 7151617181927 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •