mirror of
				https://github.com/Stunkymonkey/dotfiles.git
				synced 2025-10-30 09:52:10 +01:00 
			
		
		
		
	changed cron/blackcheck.py to submodule
This commit is contained in:
		
							parent
							
								
									50c687af66
								
							
						
					
					
						commit
						5c9c631024
					
				
					 4 changed files with 6 additions and 42 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
								
							|  | @ -11,3 +11,6 @@ | ||||||
| [submodule "bash/liquidprompt"] | [submodule "bash/liquidprompt"] | ||||||
| 	path = bash/liquidprompt | 	path = bash/liquidprompt | ||||||
| 	url = https://github.com/nojhan/liquidprompt | 	url = https://github.com/nojhan/liquidprompt | ||||||
|  | [submodule "cron/blackcheck"] | ||||||
|  | 	path = cron/blackcheck | ||||||
|  | 	url = https://github.com/Stunkymonkey/blackcheck.git | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								cron/blackcheck
									
										
									
									
									
										Submodule
									
								
							
							
						
						
									
										1
									
								
								cron/blackcheck
									
										
									
									
									
										Submodule
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | Subproject commit fb5af1f8bb72c987c49c77ea8ed558196765f011 | ||||||
|  | @ -1,41 +0,0 @@ | ||||||
| from PIL import Image |  | ||||||
| from optparse import OptionParser |  | ||||||
| # import sys |  | ||||||
| 
 |  | ||||||
| parser = OptionParser() |  | ||||||
| parser.add_option("-q", "--quiet", action="store_false", dest="verbose", |  | ||||||
|                   default=True, help="don't print status messages to stdout") |  | ||||||
| parser.add_option("-i", "--image", type="string", dest="imagename", |  | ||||||
|                   help="Name of Image") |  | ||||||
| parser.add_option("-d", "--diff", type="string", dest="diff", |  | ||||||
|                   default=0, help="maximum difference between Red, Green, Blue") |  | ||||||
| 
 |  | ||||||
| (options, args) = parser.parse_args() |  | ||||||
| 
 |  | ||||||
| if (options.imagename is None): |  | ||||||
|     parser.error("no image entered") |  | ||||||
| 
 |  | ||||||
| diff = int(options.diff) |  | ||||||
| img_path = options.imagename |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| def is_grey_scale(img_path): |  | ||||||
|     try: |  | ||||||
|         im = Image.open(img_path).convert('RGB') |  | ||||||
|     except (FileNotFoundError): |  | ||||||
|         print ("Image not found") |  | ||||||
|         quit() |  | ||||||
|     w, h = im.size |  | ||||||
|     for i in range(w): |  | ||||||
|         for j in range(h): |  | ||||||
|             r, g, b = im.getpixel((i, j)) |  | ||||||
|             if ((abs(r - g) > diff) & |  | ||||||
|                     (abs(r - b) > diff) & |  | ||||||
|                     (abs(b - g) > diff)): |  | ||||||
|                 return False |  | ||||||
|     return True |  | ||||||
| 
 |  | ||||||
| if (bool(options.verbose) == False): |  | ||||||
|     is_grey_scale(img_path) |  | ||||||
| else: |  | ||||||
|     print (is_grey_scale(img_path)) |  | ||||||
							
								
								
									
										1
									
								
								cron/blackcheck.py
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cron/blackcheck.py
									
										
									
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | /home/felix/code/python/blackcheck/blackcheck.py | ||||||
|  | @ -7,7 +7,7 @@ basename=$(dirname $(readlink -f $0)) | ||||||
| 
 | 
 | ||||||
| mkdir -p $path | mkdir -p $path | ||||||
| streamer -q -f jpeg -s $size -o $path/$now.jpeg -r 1 | streamer -q -f jpeg -s $size -o $path/$now.jpeg -r 1 | ||||||
| grey="$(python3 $basename/blackcheck.py -i $path/$now.jpeg -d 10)" | grey="$($basename/blackcheck/blackcheck.py -i $path/$now.jpeg -d 10)" | ||||||
| if [ "$grey" = "True" ] ; then | if [ "$grey" = "True" ] ; then | ||||||
| 	mv $path/$now.jpeg $path/black/$now.jpeg | 	mv $path/$now.jpeg $path/black/$now.jpeg | ||||||
| fi | fi | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Felix Buehler
						Felix Buehler